How can I style an html select box to omit drop down arrow for print?

匿名 (未验证) 提交于 2019-12-03 02:00:02

问题:

I have an html select element which I would like to style for print so that it just looks like the selected text. How can I hide the drop down arrow?

回答1:

You can't.

There is nothing in the standards that specifies that the select element has to have an arrow to indicate to the user that it has options to choose from, or how those options are shown. As those visual elements are not defined, there is naturally nothing defined for changing them.

You just have to display a different element when printing.



回答2:

The below works for Firefox, Safari, Chrome and a few others

-moz-appearance: none; -webkit-appearance: none; appearance: none; 

For IE support look at http://fetchak.com/ie-css3/



回答3:

In webkit you can specify:

-webkit-appearance: none; 

Not sure about the other browsers.



回答4:

Try this

http://www.jankoatwarpspeed.com/post/2009/07/28/reinventing-drop-down-with-css-jquery.aspx



回答5:

One idea: for the print operation, swap the combo box with a label control.



回答6:

You could provide the selected text value next to the dropdown and hide it via CSS. Then use a print stylesheet to show the text and hide the dropdown when printing.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!