我正在尝试解决如何将css生成的背景与表单单选按钮结合使用。
我有一个PHP数组的选项列表,它显示每一行(描述)和两个值为0或1的单选按钮。
我有这个只有一个项目,但是当我使用相同的代码列表时,列表中的第一个项目(单选按钮)才有效。
是否有办法让列表中的所有单选按钮都有效。
非常感谢您提供的任何帮助。
这是我正在使用的代码:
<?php do { ?>
<tr>
<td class="form_sub_headers_left"><?php print $row_BreakDown['FeedBackBreakDown']; ?></td>
<td> </td>
<td align="center">
<input type="radio" name="BreakDown" value="0" id="BreakDown_0" class="styled"/>
<label for="BreakDown_0">Bad</label>
</td>
<td align="center">
<input type="radio" name="BreakDown" value="1" id="BreakDown_1" class="styled" />
<label for="BreakDown_1">Good</label>
</td>
</tr>
<?php } while ($row_BreakDown = mysql_fetch_assoc($BreakDown)); ?>
CSS文件是:
input[type=radio], input[type=checkbox] {
display:none;
}
input[type=radio] + label, input[type=checkbox] + label {
display:inline-block;
margin:-2px;
padding: 4px 12px;
margin-bottom: 0;
font-size: 14px;
line-height: 20px;
color: #333;
text-align: center;
text-shadow: 0 1px 1px rgba(255,255,255,0.75);
vertical-align: middle;
cursor: pointer;
background-color: #f5f5f5;
background-image: -moz-linear-gradient(top,#fff,#e6e6e6);
background-image: -webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));
background-image: -webkit-linear-gradient(top,#fff,#e6e6e6);
background-image: -o-linear-gradient(top,#fff,#e6e6e6);
background-image: linear-gradient(to bottom,#fff,#e6e6e6);
background-repeat: repeat-x;
border: 1px solid #ccc;
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);
border-bottom-color: #b3b3b3;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffe6e6e6',GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
-webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);
-moz-box-shadow: inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);
box-shadow: inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);
}
input[type=radio]:checked + label, input[type=checkbox]:checked + label{
color: #FFF;
background-image: none;
outline: 1;
-webkit-box-shadow: inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);
-moz-box-shadow: inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);
box-shadow: inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);
background-color:#CC0000;
}
黑箱