Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't my <select> "font-family" property inheriting from <body>?

My code:

body {
    font-family:"Verdana",Arial,Helvetica,sans-serif;
}
.myfont {
    font-family:"Verdana",Arial,Helvetica,sans-serif;
}
<body>
    Hello
    <select>
        <option>
            Hello
        </option>
    </select>
    <select class="myfont">
        <option>
            Hello
        </option>
    </select>
</body>

Why is the first <select> element not inheriting the font-family property from the specification for <body>?

If I have to change the font for a <select> why do I have to copy the style?

like image 290
Sabya Avatar asked Jan 05 '09 12:01

Sabya


1 Answers

If you use:

select {
  font-family: inherit;
}

It'll work fine. CSS is a little quirky when it comes to form controls.

like image 133
James B Avatar answered Oct 02 '22 13:10

James B