English 中文(简体)
您如何定制超文本选择方案? [复制]
原标题:How do you customise HTML select option menus? [duplicate]
  • 时间:2011-11-20 19:39:11
  •  标签:
  • html
  • css
This question already has answers here:
Closed 11 years ago.

Possible Duplicate:
How to make a custom select option menu style without image in CSS?

能否将“超声望”选择的菜单像其子邦一样加以规范,如果是的话,你怎么做?

For example I have a menu that looks like this

<select id="music" title="Music Genres">
<option>Ambient</option>
<option>Acoustic</option>
<option>Alternative</option>
<option>Beat</option>
<option>Break</option>
<option>Bass</option>
</select>

but I need to make it look like the rest of my website and not its default design


我发现,关于YouP的这个录像导师告诉你如何做(见。 http://www.you Programme.com/watch?v=jzvRue8pS-U

最佳回答

由于不同的浏览器/操作系统使标签制度不同,因此很难打上字幕。

你可以使用Java语进行某些盒式控制,如果你重新使用 j,那么就会产生一些小gin,如jquery selected Box 你们应该开始。

Of course it s possible to do without jQuery, but more difficult. At the end of the day: Styling <select> tags is very unreliable. While very basic properties are supported, most CSS properties are not.

问题回答

这确实取决于你想要做什么。 不过,根据浏览器和操作系统(例如,总是有某种类型的清单),你能够对其及其成员作像其他网站内容一样的修改。

因此,你可以做以下任何工作:

<select id="music" title="Music Genres" style="background-color: #c0c0c0; color: #000000">
<option style="font-weight: bold">Ambient</option>
<option class="some-css-class">Acoustic</option>
</select>

如上文所述,不同的浏览器对打字表元素有不同的支持;其视觉风格由操作系统决定。

理论上,从公约的角度来看,你shouldn t风格构成要素,因为它构成增长者倡议的一部分。

根据对前一个问题的类似意见:

CSS /RUS-Styling 选箱:

select elements will only accept very limited CSS, as they re rendered by the OS, not the browser itself. You can emulate a select by using a styled ul (or ol), and some JavaScript; but styling the select element itself is near impossible to achieve reliably. Read this question for some pointers on the JavaScript approach (albeit with jQuery rather than plain JS): Html Select box options on Hover?

既然这样说,你可以在一定程度上使用简单的特别安全局,但每个浏览器将使其产出(背井离乡、边界、地势等)略有不同,与多数特别安全局的财产/价值相同。 正如其他人所说的那样,你可以使用j Query/Javascript处理,但人们对于这种做法是否好持不同看法。 有一个与上述问题相关的实例。





相关问题
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!

热门标签