Reputation: 1416
I have a Table cell like this:
<td>
@if ($user->status == 1)Present
@elseif ($user->status_detail != null) Absent(see Details)
@else Absent
@endif
</td>
So my problem is, I don't want to just give the Table cell the Word "Present" I want to give it also a Color. Do you guys have a suggestion for this problem?
Upvotes: 0
Views: 3226
Reputation: 123
<td class="status">
@if ($user->status == 1)Present
@elseif ($user->status_detail != null) Absent(see Details)
@else Absent
@endif
</td>
CSS
.status{ background:#fff;}
or should it be different when absent or present?
Upvotes: -1
Reputation: 100
Give a tag around the text "Present". then give a class to the span use CSS to give background color to span.
<td>
@if ($user->status == 1)<span class="present">Present</span>
@elseif ($user->status_detail != null) Absent(see Details)
@else <span class="absent">Absent</span>
@endif
</td>
In CSS
.present{ background:#ff0;display:block; width:100%;}
.absent{ background:#f00;display:block; width:100%;}
Upvotes: 1
Reputation: 31749
@if ($user->status == 1)
$status = Present;
$color = "green";
@elseif ($user->status_detail != null)
$status = Absent(see Details);
$color = "red"
@else
$status = Absent(see Details);
$color = "red";
@endif
<td style="background-color:{{$color}}">{{$status}}</td>
Upvotes: 0
Reputation: 111869
You need to add this in element as in the following example
<td class="
@if ($user->status == 1)
present
@else
absent
@endif
">
@if ($user->status == 1)Present
@elseif ($user->status_detail != null) Absent(see Details)
@else Absent
@endif
</td>
And then in CSS you can define styles as you want for example:
.present {background:#0f0;}
.absent {background:#f00;}
Upvotes: 3