这里是通知代码的代码:如果条件符合,我如何更改div的背景颜色?
<?php if(isset($notification) && $notification->result() >0){?>
<div class="panel-heading pull-right col-md-6"
style="height:140px; margin-top:-140px; background-color:white; overflow-y: scroll;">
<h5><strong>Student with 3 Consecutive Absences</strong></h5>
<table class="table">
<thead>
<th>Course Code-Section</th>
<th>Student Name</th>
<th>View</th>
</thead>
<tbody>
<?php foreach($notification->result() as $notif)
{
if($notif->Total >=3)
{
?>
<tr>
<td><?php echo $notif->Course_Code_Section?</td>
<td><?php echo $notif->Student?></td>
<td>
<form action="<?php echo base_url();?>index.php/attendance/check" method="post" target="_blank">
<input type="hidden" name="CID" value="<?php echo $notif->CID;?>">
<button class="btn btn-xs btn-success"><i class="icon-eye-open"></i> View</button>
<?php echo form_close();?>
</td>
</tr>
</div>
<?php }?>
<?php }?>
</tbody>
</table>
</div>
<?php }?>
这里是通知视图,默认的背景颜色是白色。因此,我希望它在条件满足时使背景颜色变为红色。
conditio最后在标签内添加一个类,比如'class =“red”',然后在你的css中声明'.red {background-color;}'。在写这个问题之前你有什么尝试吗?你有研究过吗?这是一个低价值的问题,请考虑删除它以减少SO上的问题。 – mickmackusa
你的条件是什么 - @ Ronnel Gonzales – ubm