SELECT 元素的 CSS
我目前正在尝试正确设置 SELECT 元素的 CSS 样式。
具体来说,我想要做的是让初始选择的值与箭头/选择/图标/打开选项列表的任何内容有点距离。
目前,它显示为:VALUE[V],其中 [V] 是三角形/箭头按钮。我想在 VALUE 的末尾(无论它是什么)和 [V] 按钮/选择元素的一部分之间创建一个间距。边距显然不相关,并且填充也发生在 [V] 之外。
由于我有几个 SELECT - 是否有“CLEAN”或“ELEGANT”方法可以通过 CSS 来执行此操作,而不是单独为每个元素指定宽度?
问候 坎波斯
I am currently trying to properly CSS style a SELECT element.
Specifically, what I want to do is to have the initial selected value be a bit distanced from the arrow/select/icon/whatever that opens the list of options.
Currently, it appears as: VALUE[V] where [V] is the triangle/arrow button. I want to create a spacing between the end of VALUE, whatever that comes to be, and the [V] button/part of the select element. Margin is obviously not relevant and padding takes place outside of the [V] as well.
Since I have several SELECT's - is there a 'CLEAN' or 'ELEGANT' method to do this through CSS other than individually giving a width to each of these elements?
Regards
G.Campos
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不能使用填充?它似乎做了你想做的事..看看这个:
http://jsfiddle.net/GYyKh/1/
Why cant you use padding? It seems to do what you are after.. Check this out:
http://jsfiddle.net/GYyKh/1/
让你的 select 有一个类,这样你就可以从你的 css 中调用它。然后执行类似的操作
,这将为具有该类名称的所有元素提供您指定的宽度
Make your select have a class so that you can call it from your css. Then do something like
That will give all the elements with that class name a width that you specify