Text size for drop down menu/input select not working in Safari

后端 未结 12 1583
说谎
说谎 2021-02-19 00:17

First question...

I\'m having trouble getting ANY of the Drop down menu/Input Select\'s to appear with size 18 font in Safari.

Works fine in FF.

Code:

12条回答
  •  后悔当初
    2021-02-19 00:58

    It appers select controls are non-stylable in Safari; it always uses its own OS X-style widget drawing routines to display them. Until recently, this was the norm: browsers would typically use plain OS-provided widgets for form fields. CSS2 doesn't really say how styles should apply to form fields (if at all).

    Some browsers today apply the select's font style to the options (IE7, Opera); some allow the on-page select and the pop-up options to be styled differently (Mozilla, Chrome), so the best you can do for consistency is:

    .form select, .form option {
        font: Whatever 18px;
    }
    

    But if you absolutely need a stylable drop-down in Safari you will need to write your own clunky ersatz-select in JavaScript. (Or see one of the many existing scripts and framework plugins that do this.)

提交回复
热议问题