How to change the font size of the list (not the initial view)

前端 未结 6 1361
青春惊慌失措
青春惊慌失措 2020-12-19 10:39

I have set a custom font and background for the initial view of the dropdown list (Select a choice). The font-size is 20 pixels and looks great with the custom

6条回答
  •  爱一瞬间的悲伤
    2020-12-19 10:58

    I've done this successfully on Chrome. Here's an example with custom font by Google Fonts.

    Fiddle: http://jsfiddle.net/simple/wpHKe/

    The HTML code, as yours:

    Of course, CSS:

    select {
        font-size: 20px;
        font-family: 'Averia Libre', cursive;
    }​
    

    And the Font Face that comes from Google:

    You can see this one linked as an external style sheet, but this is the code inside it.

    @font-face {
      font-family: 'Averia Libre';
      font-style: normal;
      font-weight: 400;
      src: local('Averia Libre Regular'), local('AveriaLibre-Regular'),
      url('http://themes.googleusercontent.com/static/fonts/averialibre/v1/rYVgHZZQICWnhjguGsBspHhCUOGz7vYGh680lGh-uXM.woff') format('woff');
    }
    

    Edit:

    As pointed out by @Jhilom, if you don't want this to affect all DropdDowns on your site, be sure to include a CSS Class to the Select, like so:

    HTML:

    
    

    CSS:

    .yourSelectClass
    {
    /* Your Dropdown CSS here */
    }
    

提交回复
热议问题