如何在選擇列表中添加圖像?我有一份性別選擇列表。代碼:<select><option>male</option><option>female</option><option>others</option></select>我想使用下拉列表中的圖像作為下拉列表。我想添加一個按鈕代替下拉圖標。怎么做?
3 回答

MM們
TA貢獻1886條經驗 獲得超2個贊
<select> <option style="background-image:url(male.png);">male</option> <option style="background-image:url(female.png);">female</option> <option style="background-image:url(others.png);">others</option></select>
HTML
<select id="gender"> <option>male</option> <option>female</option> <option>others</option></select>
CSS
select#gender option[value="male"] { background-image:url(male.png); }select#gender option[value="female"] { background-image:url(female.png); }select#gender option[value="others"] { background-image:url(others.png); }

肥皂起泡泡
TA貢獻1829條經驗 獲得超6個贊
<select name='state' style='height: 45px; font-family:Arial, FontAwesome;'><option value=''> All States</option> <option value='enabled' style='color:green;'> Enabled</option><option value='paused' style='color:orange;'>  Paused</option><option value='archived' style='color:red;'> Archived</option></select>
注意 字體系列:Arial,FontAwome;需要按樣式分配,以便選擇,就像在示例中給出的一樣!
- 3 回答
- 0 關注
- 771 瀏覽
相關問題推薦
添加回答
舉報
0/150
提交
取消