[thelist] Multi-Colored Drop-Down possible?

James Aylard evolt at equilon-mrc.com
Thu Mar 29 23:59:01 CST 2001


Ron,

    Sure you can, at least in IE 4+ and Netscape 6 (not in Opera, however).
Assign classes to your option elements, and then set the colors in a style
sheet (also, it's wise to set the background-color property whenever you set
the color property), e.g.:

<head>
<style type="text/css">
  <!--
    .americas {
      color: #0000ff ;
      background-color: #ffffff ;
    }
    .asia {
      color: #009900 ;
      background-color: #ffffff ;
    }
    .europe {
      color: #ff0000 ;
      background-color: #ffffff ;
    }
  -->
</style>
</head>
<body>
  <form>
    <select>
      <option class="americas">United States</option>
      <option class="americas">Mexico</option>
      <option class="americas">Canada</option>
      <option class="asia">China</option>
      <option class="asia">Japan</option>
      <option class="europe">United Kingdom</option>
      <option class="europe">Germany</option>
    </select>
  </form>
</body>

James Aylard





More information about the thelist mailing list