正如您在图像上看到的,我在选择框中有7个选项。是否可以在一个<option>
或渐变背景中制作2个div。我需要在一个<option>
中获得2种颜色。
<td class="footable-visible" style="width:1px; ">
<div class="container" style="width:130px;">
<div class="row">
<select id="mySelect" class="form-control">
<option style="color:white;background-color:#72D527;"> </option>
<option style="color:white;background-color:#4DB6AC;"> </option>
<option style="color:white;background-color:#CE93D8;"> </option>
<option style="color:white;background-color:#FFAB91;"> </option>
<option style="color:white;background-color:#F9A825;"> </option>
<option style="color:white;background-color:#BCAAA4;"> </option>
<option style="color:white;background-color:#9E9E9E;"> </option>
</select>
</div>
</div>
</td>
编辑:Gradient在Firefox中运行,但在Chrome中不运行
1. Firefox 2. Chrome
答案 0 :(得分:2)
答案 1 :(得分:1)
这是你的代码:
<td class="footable-visible" style="width:1px; ">
<div class="container" style="width:130px;">
<div class="row">
<select id="mySelect" class="form-control">
<option style="color:white; background: -webkit-linear-gradient(#72D527, #C7EDC6); background: -o-linear-gradient(#72D527, #C7EDC6); background: -moz-linear-gradient(#72D527, #C7EDC6); background: linear-gradient(#72D527, #C7EDC6); "> </option>
<option style="color:white;background-color:#4DB6AC;"> </option>
<option style="color:white;background-color:#CE93D8;"> </option>
<option style="color:white;background-color:#FFAB91;"> </option>
<option style="color:white;background-color:#F9A825;"> </option>
<option style="color:white;background-color:#BCAAA4;"> </option>
<option style="color:white;background-color:#9E9E9E;"> </option>
</select>
</div>
</div>