CSS font-family for separate options in a html select element.

MrBlue

Senior Member
Joined
Dec 18, 2009
Messages
975
Reaction score
695
This is how you would change the css font-family for separate options in a html select element.

Code:
<select>


  <optgroup style="font-family:arial">
    <option>Arial</option>
  </optgroup>


  <optgroup style="font-family:verdana">
    <option>veranda</option>
  </optgroup>


  <optgroup style="font-family:other">
    <option>other</option>
  </optgroup>


</select>

Fiddle:
Code:
https://jsfiddle.net/c0ovw6tb/
 
Hahaha. If i were you i will use CSS. And use class or tag to group and easily modify the font. Sorry for the word but the way you code is obsolete :D. The best to do it is to organize each code, group them.
 
ya if you don't use css classes the hardcoded html could unintentionally overwrite css styling and cause problems
 
Back
Top