HTML使用多种颜色选择DropDown列表 [英] HTML Select DropDown list with multiple colours

查看:172
本文介绍了HTML使用多种颜色选择DropDown列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



例如:

Option 1 = green

Option 2 = blue

etc

是你想要的风格下拉列表



< 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 =redvalue =../getting_started/\">开始使用< / option> < option class =pinkvalue =../getting_started/html_intro1.htm\"> ;-介绍HTML< / option> < / select>


Is it possible to have different colours for different items in the dropdown list?

For example:

Option 1 = green
Option 2 = blue
etc

解决方案

here is what you want Styling Dropdown Lists

    <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>

这篇关于HTML使用多种颜色选择DropDown列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆