HTML选择具有多种颜色的DropDown列表

mou*_*iec 9 html html-select colors

是否可以在下拉列表中为不同的项目设置不同的颜色?

例如:

选项1 =绿色
选项2 =蓝色

ACP*_*ACP 12

这就是你想要的样式下拉列表

    <style type="text/css">
    option.red {background-color: #cc0000; font-weight: bold; font-size: 12px;}
    option.pink {background-color: #ffcccc;}
    </style>

    <select name=colors>
    <option class="red" value= "../getting_started/">Getting Started </option>
    <option class="pink" value= "../getting_started/html_intro1.htm">- Intro to HTML
     </option>
    </select>
Run Code Online (Sandbox Code Playgroud)

  • 在Mac OSX中无法在chrome中使用. (4认同)