一般情况下,它被认为是一个不好的做法,风格标准表单控件,因为输出看起来每个浏览器如此不同。有关一些渲染示例,请参阅:http://www.456bereastreet.com/lab/styling-form-controls-revisited/select-single/。
话虽这么说,我已经有一些运气使背景色的RGBA值:
<!DOCTYPE html>
<html>
<head>
<style>
body {
background: #d00;
}
select {
background: rgba(255,255,255,0.1) url('http://www.google.com/images/srpr/nav_logo6g.png') repeat-x 0 0;
padding:4px;
line-height: 21px;
border: 1px solid #fff;
}
</style>
</head>
<body>
<select>
<option>Foo</option>
<option>Bar</option>
<option>Something longer</option>
</body>
</html>
谷歌Chrome仍然会呈现在彩色背景图像,你传递给RGBA顶部的梯度( r,g,b,0.1),但是选择一种颜色来补充图像并使alpha 0.1减少这种效果。
将行高添加到应用于选择元素的类可以解决问题。谢谢。 – 2014-02-12 10:39:33