Reputation: 35
I am using following div in my laravel app and currently I have boarder style now I need color background as red adtype ==1 and other green.
<div style="border-style: solid;
color: {{ $vehicule->adtype === 1 ? 'black' : 'blue' }} ">
<img src="/images/{{ $upload->resized_name }}" height="150" width="250">
</div>
how can I do this?
Upvotes: 0
Views: 548
Reputation: 1301
Use this code to change your background color:
<div style="border-style: solid; color: {{ $vehicule->adtype === 1 ? 'black' : 'blue' }}; background-color: {{ $vehicule->adtype === 1 ? 'red' : 'green' }}">
<img src="/images/{{ $upload->resized_name }}" height="150" width="250"></a>
</div>
Upvotes: 0
Reputation: 14288
color
is for the text, use background-color
property.
background-color: {{ $vehicule->adtype === 1 ? 'red' : 'green' }}
Upvotes: 3