How do I style form drop down lists?

后端 未结 7 1739
谎友^
谎友^ 2021-02-04 14:55

I have searched far and wide on the Internet but have not found anything helpful regarding how to style the dropdown portion of a dropdown list in a form. I would appreciate a p

7条回答
  •  感情败类
    2021-02-04 15:15

    You can apply styles using the SELECT selector or applying a classname to a SELECT element. However, you'll run into issues with IE < 8 applying things like borders to the element.

    You can then target options by using the OPTION selector.

    SELECT { border: solid 1px red; font-weight: bold; }
    OPTION { background:green; font-style: italic; }
    

    Should give you a drop down with a red border (if using FF or IE8 in Standards mode) with bold text, and the options should be italic with a green background.

提交回复
热议问题