How to make different border colors in div box?












0















working with Laravel and I have display some div box background color according to adtype values of the table. currently using following background colors according to adtype values,



<div style="border-style: solid; background-color: {{ $vehicule->adtype === 1 ? '#FFEFD5' : '#FFFFFF' }} "> 


but now I need paste different color to border like if adtype===1 red and adtype===0 green. I have only 2 adtype values like 1 and 0. how can I do this?










share|improve this question























  • You can set the CSS property "border-color" just like you're setting the background-color in your template there.

    – YetiCGN
    Nov 21 '18 at 11:15


















0















working with Laravel and I have display some div box background color according to adtype values of the table. currently using following background colors according to adtype values,



<div style="border-style: solid; background-color: {{ $vehicule->adtype === 1 ? '#FFEFD5' : '#FFFFFF' }} "> 


but now I need paste different color to border like if adtype===1 red and adtype===0 green. I have only 2 adtype values like 1 and 0. how can I do this?










share|improve this question























  • You can set the CSS property "border-color" just like you're setting the background-color in your template there.

    – YetiCGN
    Nov 21 '18 at 11:15
















0












0








0








working with Laravel and I have display some div box background color according to adtype values of the table. currently using following background colors according to adtype values,



<div style="border-style: solid; background-color: {{ $vehicule->adtype === 1 ? '#FFEFD5' : '#FFFFFF' }} "> 


but now I need paste different color to border like if adtype===1 red and adtype===0 green. I have only 2 adtype values like 1 and 0. how can I do this?










share|improve this question














working with Laravel and I have display some div box background color according to adtype values of the table. currently using following background colors according to adtype values,



<div style="border-style: solid; background-color: {{ $vehicule->adtype === 1 ? '#FFEFD5' : '#FFFFFF' }} "> 


but now I need paste different color to border like if adtype===1 red and adtype===0 green. I have only 2 adtype values like 1 and 0. how can I do this?







html css laravel-5






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 21 '18 at 11:03









MuruMuru

738




738













  • You can set the CSS property "border-color" just like you're setting the background-color in your template there.

    – YetiCGN
    Nov 21 '18 at 11:15





















  • You can set the CSS property "border-color" just like you're setting the background-color in your template there.

    – YetiCGN
    Nov 21 '18 at 11:15



















You can set the CSS property "border-color" just like you're setting the background-color in your template there.

– YetiCGN
Nov 21 '18 at 11:15







You can set the CSS property "border-color" just like you're setting the background-color in your template there.

– YetiCGN
Nov 21 '18 at 11:15














2 Answers
2






active

oldest

votes


















0














You can set the CSS property "border-color" just like you're setting the background-color in your template there.



<div style="border-style: solid; border-color: {{ $vehicule->adtype === 1 ? 'red' : 'green' }}; 
background-color: {{ $vehicule->adtype === 1 ? '#FFEFD5' : '#FFFFFF' }} ">





share|improve this answer
























  • well it is working fine

    – Muru
    Nov 21 '18 at 11:29



















-1














Use PHP switch:



<?php
$adtype = $vehicule->adtype
switch((int) $adtype)
{
case 1:
$bgcolor = "red";
$bordercolor = "somecolor";
break;

case 2:
$bgcolor = "green";
$bordercolor = "someothercolor";
break;


default:
$bgcolor = "#ffffff";
$bordercolor = "#defaultcolor";

}
?>
<div style="border-style: solid; background-color: <?php echo $bgcolor; ?>; border-width:1px; border-style:solid; border-color:<?php echo $bordercoler; ?>;">





share|improve this answer


























  • may I use boarder color in like background color ?

    – Muru
    Nov 21 '18 at 11:16











  • @Jamie_D Why would switching to PHP work better than doing this in Blade?

    – YetiCGN
    Nov 21 '18 at 11:16











  • @YetiCGN Downvoted? Really? Last time I checked Laravel 5 was a PHP framework not to mention using switch gives the option of different background and border colors for each criteria ...

    – Jamie_D
    Nov 21 '18 at 11:29













  • That's like saying "hey, why don't you solve your problem with JavaScript?" just because JS is used in the project as well. Before your edit there was no mention of a border-color and that's when I downvoted and commented. Even after your edit your code doesn't work, because it uses an undefined variable $bordercoler. I stand by my downvote.

    – YetiCGN
    Nov 21 '18 at 11:33













  • OK then. The boss just added three more ad types. Give us your Blade solution and we'll all be happy.

    – Jamie_D
    Nov 21 '18 at 11:41











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53410724%2fhow-to-make-different-border-colors-in-div-box%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You can set the CSS property "border-color" just like you're setting the background-color in your template there.



<div style="border-style: solid; border-color: {{ $vehicule->adtype === 1 ? 'red' : 'green' }}; 
background-color: {{ $vehicule->adtype === 1 ? '#FFEFD5' : '#FFFFFF' }} ">





share|improve this answer
























  • well it is working fine

    – Muru
    Nov 21 '18 at 11:29
















0














You can set the CSS property "border-color" just like you're setting the background-color in your template there.



<div style="border-style: solid; border-color: {{ $vehicule->adtype === 1 ? 'red' : 'green' }}; 
background-color: {{ $vehicule->adtype === 1 ? '#FFEFD5' : '#FFFFFF' }} ">





share|improve this answer
























  • well it is working fine

    – Muru
    Nov 21 '18 at 11:29














0












0








0







You can set the CSS property "border-color" just like you're setting the background-color in your template there.



<div style="border-style: solid; border-color: {{ $vehicule->adtype === 1 ? 'red' : 'green' }}; 
background-color: {{ $vehicule->adtype === 1 ? '#FFEFD5' : '#FFFFFF' }} ">





share|improve this answer













You can set the CSS property "border-color" just like you're setting the background-color in your template there.



<div style="border-style: solid; border-color: {{ $vehicule->adtype === 1 ? 'red' : 'green' }}; 
background-color: {{ $vehicule->adtype === 1 ? '#FFEFD5' : '#FFFFFF' }} ">






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 21 '18 at 11:19









YetiCGNYetiCGN

53337




53337













  • well it is working fine

    – Muru
    Nov 21 '18 at 11:29



















  • well it is working fine

    – Muru
    Nov 21 '18 at 11:29

















well it is working fine

– Muru
Nov 21 '18 at 11:29





well it is working fine

– Muru
Nov 21 '18 at 11:29













-1














Use PHP switch:



<?php
$adtype = $vehicule->adtype
switch((int) $adtype)
{
case 1:
$bgcolor = "red";
$bordercolor = "somecolor";
break;

case 2:
$bgcolor = "green";
$bordercolor = "someothercolor";
break;


default:
$bgcolor = "#ffffff";
$bordercolor = "#defaultcolor";

}
?>
<div style="border-style: solid; background-color: <?php echo $bgcolor; ?>; border-width:1px; border-style:solid; border-color:<?php echo $bordercoler; ?>;">





share|improve this answer


























  • may I use boarder color in like background color ?

    – Muru
    Nov 21 '18 at 11:16











  • @Jamie_D Why would switching to PHP work better than doing this in Blade?

    – YetiCGN
    Nov 21 '18 at 11:16











  • @YetiCGN Downvoted? Really? Last time I checked Laravel 5 was a PHP framework not to mention using switch gives the option of different background and border colors for each criteria ...

    – Jamie_D
    Nov 21 '18 at 11:29













  • That's like saying "hey, why don't you solve your problem with JavaScript?" just because JS is used in the project as well. Before your edit there was no mention of a border-color and that's when I downvoted and commented. Even after your edit your code doesn't work, because it uses an undefined variable $bordercoler. I stand by my downvote.

    – YetiCGN
    Nov 21 '18 at 11:33













  • OK then. The boss just added three more ad types. Give us your Blade solution and we'll all be happy.

    – Jamie_D
    Nov 21 '18 at 11:41
















-1














Use PHP switch:



<?php
$adtype = $vehicule->adtype
switch((int) $adtype)
{
case 1:
$bgcolor = "red";
$bordercolor = "somecolor";
break;

case 2:
$bgcolor = "green";
$bordercolor = "someothercolor";
break;


default:
$bgcolor = "#ffffff";
$bordercolor = "#defaultcolor";

}
?>
<div style="border-style: solid; background-color: <?php echo $bgcolor; ?>; border-width:1px; border-style:solid; border-color:<?php echo $bordercoler; ?>;">





share|improve this answer


























  • may I use boarder color in like background color ?

    – Muru
    Nov 21 '18 at 11:16











  • @Jamie_D Why would switching to PHP work better than doing this in Blade?

    – YetiCGN
    Nov 21 '18 at 11:16











  • @YetiCGN Downvoted? Really? Last time I checked Laravel 5 was a PHP framework not to mention using switch gives the option of different background and border colors for each criteria ...

    – Jamie_D
    Nov 21 '18 at 11:29













  • That's like saying "hey, why don't you solve your problem with JavaScript?" just because JS is used in the project as well. Before your edit there was no mention of a border-color and that's when I downvoted and commented. Even after your edit your code doesn't work, because it uses an undefined variable $bordercoler. I stand by my downvote.

    – YetiCGN
    Nov 21 '18 at 11:33













  • OK then. The boss just added three more ad types. Give us your Blade solution and we'll all be happy.

    – Jamie_D
    Nov 21 '18 at 11:41














-1












-1








-1







Use PHP switch:



<?php
$adtype = $vehicule->adtype
switch((int) $adtype)
{
case 1:
$bgcolor = "red";
$bordercolor = "somecolor";
break;

case 2:
$bgcolor = "green";
$bordercolor = "someothercolor";
break;


default:
$bgcolor = "#ffffff";
$bordercolor = "#defaultcolor";

}
?>
<div style="border-style: solid; background-color: <?php echo $bgcolor; ?>; border-width:1px; border-style:solid; border-color:<?php echo $bordercoler; ?>;">





share|improve this answer















Use PHP switch:



<?php
$adtype = $vehicule->adtype
switch((int) $adtype)
{
case 1:
$bgcolor = "red";
$bordercolor = "somecolor";
break;

case 2:
$bgcolor = "green";
$bordercolor = "someothercolor";
break;


default:
$bgcolor = "#ffffff";
$bordercolor = "#defaultcolor";

}
?>
<div style="border-style: solid; background-color: <?php echo $bgcolor; ?>; border-width:1px; border-style:solid; border-color:<?php echo $bordercoler; ?>;">






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 21 '18 at 11:18

























answered Nov 21 '18 at 11:12









Jamie_DJamie_D

51938




51938













  • may I use boarder color in like background color ?

    – Muru
    Nov 21 '18 at 11:16











  • @Jamie_D Why would switching to PHP work better than doing this in Blade?

    – YetiCGN
    Nov 21 '18 at 11:16











  • @YetiCGN Downvoted? Really? Last time I checked Laravel 5 was a PHP framework not to mention using switch gives the option of different background and border colors for each criteria ...

    – Jamie_D
    Nov 21 '18 at 11:29













  • That's like saying "hey, why don't you solve your problem with JavaScript?" just because JS is used in the project as well. Before your edit there was no mention of a border-color and that's when I downvoted and commented. Even after your edit your code doesn't work, because it uses an undefined variable $bordercoler. I stand by my downvote.

    – YetiCGN
    Nov 21 '18 at 11:33













  • OK then. The boss just added three more ad types. Give us your Blade solution and we'll all be happy.

    – Jamie_D
    Nov 21 '18 at 11:41



















  • may I use boarder color in like background color ?

    – Muru
    Nov 21 '18 at 11:16











  • @Jamie_D Why would switching to PHP work better than doing this in Blade?

    – YetiCGN
    Nov 21 '18 at 11:16











  • @YetiCGN Downvoted? Really? Last time I checked Laravel 5 was a PHP framework not to mention using switch gives the option of different background and border colors for each criteria ...

    – Jamie_D
    Nov 21 '18 at 11:29













  • That's like saying "hey, why don't you solve your problem with JavaScript?" just because JS is used in the project as well. Before your edit there was no mention of a border-color and that's when I downvoted and commented. Even after your edit your code doesn't work, because it uses an undefined variable $bordercoler. I stand by my downvote.

    – YetiCGN
    Nov 21 '18 at 11:33













  • OK then. The boss just added three more ad types. Give us your Blade solution and we'll all be happy.

    – Jamie_D
    Nov 21 '18 at 11:41

















may I use boarder color in like background color ?

– Muru
Nov 21 '18 at 11:16





may I use boarder color in like background color ?

– Muru
Nov 21 '18 at 11:16













@Jamie_D Why would switching to PHP work better than doing this in Blade?

– YetiCGN
Nov 21 '18 at 11:16





@Jamie_D Why would switching to PHP work better than doing this in Blade?

– YetiCGN
Nov 21 '18 at 11:16













@YetiCGN Downvoted? Really? Last time I checked Laravel 5 was a PHP framework not to mention using switch gives the option of different background and border colors for each criteria ...

– Jamie_D
Nov 21 '18 at 11:29







@YetiCGN Downvoted? Really? Last time I checked Laravel 5 was a PHP framework not to mention using switch gives the option of different background and border colors for each criteria ...

– Jamie_D
Nov 21 '18 at 11:29















That's like saying "hey, why don't you solve your problem with JavaScript?" just because JS is used in the project as well. Before your edit there was no mention of a border-color and that's when I downvoted and commented. Even after your edit your code doesn't work, because it uses an undefined variable $bordercoler. I stand by my downvote.

– YetiCGN
Nov 21 '18 at 11:33







That's like saying "hey, why don't you solve your problem with JavaScript?" just because JS is used in the project as well. Before your edit there was no mention of a border-color and that's when I downvoted and commented. Even after your edit your code doesn't work, because it uses an undefined variable $bordercoler. I stand by my downvote.

– YetiCGN
Nov 21 '18 at 11:33















OK then. The boss just added three more ad types. Give us your Blade solution and we'll all be happy.

– Jamie_D
Nov 21 '18 at 11:41





OK then. The boss just added three more ad types. Give us your Blade solution and we'll all be happy.

– Jamie_D
Nov 21 '18 at 11:41


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53410724%2fhow-to-make-different-border-colors-in-div-box%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Paul Cézanne

UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

Angular material date-picker (MatDatepicker) auto completes the date on focus out