主要写下关于select标签中option标签字体的样式设置,以及他们整体的背景样式的设置
<body>
<hade>
<style type="text/css">
.stationdiv{margin:10px;}
.stationlabel{margin-right:20px;width:75px;}
.scinput {width:150px; height:32px; line-height:32px; border-top:solid 1px #a7b5bc; border-left:solid 1px #a7b5bc; border-right:solid 1px #ced9df; border-bottom:solid 1px #ced9df; background:url(../images/inputbg.gif) repeat-x;
text-indent:10px;}
.input{width:550px;}
</style>
</hade>
<div class="stationdiv">
<label class="stationlabel">核查方式</label>
<select id="tasktype" name="tasktype" class="scinput input" disabled="disabled"
style="background:#f5f5f5;color:#cccccc;" >
<option>实时任务</option>
</select>
</div>
</body>
前台页面效果 大家重点看我上面代码对应的效果就好,
简单的贴上我写的代码,input标签的disabled="disabled" 这样设置主要是让下拉框变为不可选的状态(目前项目需求),
最难搞的是怎样设置option标签里面字体的颜色,网上找了很多答案,大部分说直接在option标签里面写上 style="color:red" 或者是style="background:red" 还有的是
style="font-color:red" 然而并没有什么卵用,option标签里面的字体依旧是黑色,没有任何变化,后来我在select标签写上style="background:#f5f5f5;color:#cccccc;" 这行代码,
也就是整体的背景颜色和字体样式一起搞,嘿嘿,没想到还真成了,虽然这只是一个小小的问题,但对于我这种专注于java后台的程序员也是一种成长啊,感觉有点用,所以在此记下,也希望可以带给大家一点前端开发的灵感吧,哈哈,如果帮助到你,请多多支持,谢谢!