控制选择框的宽度
我试图更改 框..主要在 IE 中......
i was trying to change the width of a particular optional value under <select>
attribute, something like this. But i am getting troubled as in IE the select box along with the option value gets expanded. Is there any simple way to make the <option>
only to expand and not the <select>
box.. mainly in IE ....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
似乎是与所有较新的浏览器兼容的解决方案。
Seems to be quite compatible solution working with all newer browsers.
这可以使用
中的 jQuery 插件来完成
http://www.jainaewen.com/files/javascript/ jquery/ie-select-style/#demo
该插件使用起来非常简单。这是一些完整工作代码的细分。
HTML
CSS
jQuery
不要忘记包含 jQuery Js 文件和此插件的 Js 文件。
然后将以下内容放在后面:
所有这些都应该放在结束
标签之前
检查工作示例 http://jsfiddle.net/7Vv8u/2/
This can be done using the jQuery plugin found at
http://www.jainaewen.com/files/javascript/jquery/ie-select-style/#demo
The plugin is very simple to use. Here's a breakdown of some full working code.
HTML
CSS
jQuery
Don't forget to include the jQuery Js file and this plugins' Js file.
Then put the following right after:
All this should go before the closing
</body>
tagCheck working example at http://jsfiddle.net/7Vv8u/2/
样式化
我建议使用
元素并应用功能/设计以使其更像
这篇文章可能会帮助您
Styling
<select>
items is a bit of a problem since there is no cross-browser solution without using JavaScript - since each browser handles rendering of the form controls differently.I would suggest using an
<ul>
element and applying the functionality/design to act more like a<select>
element - using JavaScriptthis article may help you with this