none
How to set the select control and the drop-down list font-size different?

    Question

  • How to set the select control and the drop-down list font-size different?I tried use css to modify like this:

    select{
    font-size:40pt;
    color:red;
    }
    option{
    font-size:20pt;
    color:blue;
    }
    but  I find that the drop-down list 's  style about the font-size is also used the 40pt, it is cover by the select style,the color is not covered.How can I realize it?Thanks!
    Wednesday, August 28, 2013 6:24 AM

Answers

  • Hi bing_g

    It's not possible, you could read the document here:http://msdn.microsoft.com/en-us/library/ms535877%28v=vs.85%29.aspx

    Except for background-color and color, style settings applied through the style object for the option element are ignored. In addition, style settings applied directly to individual options override those applied to the containing select element as a whole.

    Best Regards,

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by bing_g Tuesday, September 03, 2013 2:10 AM
    Thursday, August 29, 2013 1:47 AM
    Moderator

All replies

  • Try this:

    select{
    font-size:40pt;
    color:red;
    }
    
    optgroup{
    font-size:20pt;
    color:blue;
    }

    <select id="test" name="test">
            <optgroup>
                <option>A </option>
                <option>B </option>
            </optgroup>
    </select>

    Wednesday, August 28, 2013 7:09 AM
  • Hi bing_g

    It's not possible, you could read the document here:http://msdn.microsoft.com/en-us/library/ms535877%28v=vs.85%29.aspx

    Except for background-color and color, style settings applied through the style object for the option element are ignored. In addition, style settings applied directly to individual options override those applied to the containing select element as a whole.

    Best Regards,

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by bing_g Tuesday, September 03, 2013 2:10 AM
    Thursday, August 29, 2013 1:47 AM
    Moderator
  • Hi,thanks!You helped me a lot.

    Tuesday, September 03, 2013 2:10 AM