选择标签样式
有没有办法在CSS中设置 标签的背景图像,但问题是它没有采用行高,因此它没有垂直向中间(尤其是在 FF 中)对齐,并且使用填充会使箭头看起来很难看。我该如何解决这个问题?
Is there a way to style <select>
or <option>
tags in css? I am using a image for background for <select>
tag, but the problem is that it is not taking line-height, so it isn't aligned towards the middle (especially in FF) vertically, and using padding makes the arrow look ugly. How would I fix that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
select
标签非常很难设计样式。事实上,除了一些非常基本样式之外,它们几乎都是无法设计的。原因是浏览器不是绘制它的人。它(主要)由操作系统处理。
如果您需要更多控制,您应该用 Javascript 替换它们。这样,它们只是一堆可以通过 CSS 轻松操作的 div/span。
令人惊叹的 名为“chosen”的 jQuery 插件 基本上就是围绕这个想法构建的。一探究竟。
select
tags are very difficult to style. If fact, besides for some very basic styles, they are pretty much un-style-able.The reason for that is that the browser is not the one drawing it. It is handled (mainly) by the OS.
If you need more control, you should replace them with Javascript. That way, they're just a bunch of divs/spans that can easily be manipulated by CSS.
The amazing jQuery plugin called "chosen" is basically built around this idea. Check it out.
给出内联样式,你就会得到。
Give inline style, you will get.