Targeting select option with CSS - HTML CSS CSS

HTML CSS examples for CSS:Selector

Description

Targeting select option with CSS

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
#category option[selected] {
   color:Chartreuse;
}
</style> <!--from   w  ww .  j a  va2 s .c om-->
 </head> 
 <body> 
  <div class="form-group"> 
   <select class="form-control" id="category"> <option disabled selected>Lorem ipsum dolor</option> <option>L</option> <option>L</option> <option>L</option> <option>L</option> </select> 
  </div>  
 </body>
</html>

Related Tutorials