@MikeWWyatt
我知道它已經有一段時間,因爲你問過,但我創造這樣的:在一個段落是位置
- 後餘音:相對
- 創建一個元素是絕對位置
- 可以選擇與選定背景顏色相同的顏色
- 使用jQuery將選項顏色更改爲白色(或任何您想要的顏色)使用.change( )以及隱藏
HTML
<p>I am a: <span class='pretend-option'>Please choose one</span>
<select name="example">
<option disabled="disabled" selected="selected">Please choose one</option>
<option value="consumer">Consumer</option>
<option value="supplier">Supplier</option>
<option value="retailer">Retailer</option>
</select>
</p>
jQuery的
$('select').change(function() {
$(this).css('color', 'white');
$(this).parent('p').children('.pretend-option').css('z-index', -1);
});
CSS
select, option {
-webkit-appearance: none;
-webkit-border-radius: 0px;
border-radius: 0;
display: block;
}
p {
position: relative;
}
select {
padding: 7px;
background-color: blue;
color: blue;
}
.pretend-option {
position: absolute;
bottom: 0.5em;
color: #fff;
left: 0.5em;
pointer-events: none;
z-index: 1;
font-style: italic;
}
這裏如果你有興趣小提琴:https://jsfiddle.net/ej34bea0/
你可能是對的。 – SLaks 2010-02-15 20:40:57