HTML
我必须更改 html 选择(组合框)的按钮颜色,但由于无法将图像直接添加到选择的按钮,所以我所做的就是在组合框后面设置图像,然后使组合框透明“过滤器:alpha(不透明度=0);”在 iexplore 和“不透明度:0;”中在火狐浏览器中。 这样,您就看不到选择,而是看到图像(类似于选择,但具有其他颜色,并且由于单击时选择位于图像顶部(更大的 z 索引),因此您可以当它显示选项时,是的,你可以看到它们,
问题是我需要它在 Firefox、Chrome 和 IEXPLORE 中工作。 Firefox 和 Chrome 没有问题,但 Iexplore 中的选项文本显示时没有其他浏览器中的抗锯齿效果。页面的所有文本都已抗锯齿,因此我也需要对其进行抗锯齿。
我已经知道如何制作它,但是如果文本位于 div、H1 内,则它可以工作,但如果它位于选择的选项中,则不行。 例如:
但它在选择中不起作用:(
提前感谢!!
I had to change the button color of an html select (combobox), but since it is not posible to add an image directly to the button of a select, what I did was setting an image behind the combobox, and then making the combobox transparent "filter:alpha(opacity=0);" in iexplore and "opacity:0;" in firefox.
This way, you do not see the select, instead, you see the image (what is like a select, but with other color, and since the select is on top of the image (greater z-index) when you click, you are clicking the select. And when it shows the options, yes, you can see them.
The problem is that I need it to work in Firefox, Chrome AND IEXPLORE.
There is no problem with Firefox and Chrome, but the text of the options in Iexplore, appears without the antialias it gets in the other browsers. All the text of the page is antialiased, so I need this to be also antialiased.
I have seen how to make it, but it works if the text is inside a div, a H1 but not if it is in the options of a select.
For example:
http://www.useragentman.com/blog/2010/09/02/how-to-make-cleartype-font-face-fonts-and-css-visual-filters-play-nicely-together/
But it does not work in a select :(
Thanks in advance!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我似乎记得 IE 不允许您仅在整个
或者,还有使用非本机元素实现 select 的 javascript 解决方案。通过避免渲染本机选择,您可以避免触发 IE 表单元素实现(使用本机系统对象)特有的错误。实现太多,无法列出,因此只需搜索“自定义 javascript 下拉列表”。
I seem to remember IE doesn't let you color the background on an
<option>
only on the entire<select>
. The hack you describe requires a background color and chroma so maybe try setting them on the select element.Alternatively there are javascript solutions that implement select using non-native elements. By avoiding the rendering of a native select you avoid triggering bugs that are unique to IE's implementation of form elements (which uses native system objects). There are too many implementations to list so just search for 'custom javascript dropdown'.