English 中文(简体)
A. 选定要素的变化
原标题:Changing selected background color of a select element
  • 时间:2011-08-24 10:36:05
  •  标签:
  • html
  • select

我有:

<div id="root">
    <select onchange="go()">
        <option value="1" selected>A
        </option><option value="2">B
        </option><option value="3">C
        </option><option value="4">D
        </option><option value="5">E
        </option>
    </select>
</div>

我怎样才能改变所选择的标准背景蓝色?

我无法找到任何解决办法,甚至无法找到其他问题的解决方案。

问题回答

这一部分内容将改写如下:<代码>,选取<>/代码>,以红色

option[selected]{
    background:#ff0000;
}

I m 不是向这一选择人提供浏览器支持的100%。

你们可以直接在某个选定要素上这样做。 您应使用外部图书馆,将您的选址改为div模板,使您能够改变风格。

I m using Chosen,而且它运作良好。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签