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

后端 未结 6 1503
星月不相逢
星月不相逢 2020-12-17 20:10

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?

相关标签:
6条回答
  • 2020-12-17 20:46

    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.

    0 讨论(0)
  • 2020-12-17 20:51

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

    0 讨论(0)
  • 2020-12-17 20:52

    Try this

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

    0 讨论(0)
  • 2020-12-17 20:55

    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.

    0 讨论(0)
  • 2020-12-17 20:57

    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/

    0 讨论(0)
  • 2020-12-17 20:57

    In webkit you can specify:

    -webkit-appearance: none;
    

    Not sure about the other browsers.

    0 讨论(0)
提交回复
热议问题