编辑 HTML 选择按钮的 CSS 样式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13344267/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:50:57  来源:igfitidea点击:

Edit CSS Styling of HTML Select Button

htmlcssformsbutton

提问by Scott Hallauer

Possible Duplicate:
Is it possible to style a select box?

可能的重复:
是否可以设置选择框的样式?

I would like to know if it is possible with CSS to change the styling of a HTML select field. I want to make the button with the arrow inside transparent but keep the arrow there, so basically removing the button look of the arrow.

我想知道是否可以使用 CSS 更改 HTML 选择字段的样式。我想让带有内部箭头的按钮透明但将箭头保留在那里,因此基本上删除了箭头的按钮外观。

采纳答案by noslone

That is not possible to accomplish cross browser with only CSS.

仅使用 CSS 无法实现跨浏览器。

To get nice looking select fields you must use javascript.

要获得漂亮的选择字段,您必须使用 javascript。

There are a couple libraries for this:

为此有几个库:

http://www.emblematiq.com/lab/niceforms/

http://www.emblematiq.com/lab/niceforms/

http://uniformjs.com/

http://uniformjs.com/

I am pretty sure you can find more if you just google for it.

我很确定你可以找到更多,如果你只是谷歌搜索。

回答by Pieter Willaert

http://bavotasan.com/2011/style-select-box-using-only-css/

http://bavotasan.com/2011/style-select-box-using-only-css/

be sure to read the comments too, this will probably not work in old(er) browsers, jquery is the better solution

请务必阅读评论,这可能不适用于旧的(er)浏览器,jquery 是更好的解决方案