Set a background color for all disabled <option> elements - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:disabled

Description

Set a background color for all disabled <option> elements

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
option:disabled {
    background: red;
}
</style><!--from   w  ww . j  av a 2s.  c o  m-->
</head>
<body>

<select>
  <option value="css">CSS</option>
  <option value="saab" disabled>Saab</option>
  <option value="java">Java</option>
  <option value="audi" disabled>Audi</option>
  <option value="bmw">BMW</option>
</select>

</body>
</html>

Related Tutorials