Himas Rafeek
Posted on: 1 year ago

Select Using Styled Optgroup Tags

Having a handle for groups of options allows script driven dynamic effects to manage changes of presentation with in the select without having to refresh or use other inefficient methods of updating the display.

                                          CSS: #styled optgroup {
    border: 1px solid red;
    margin: 10px 8px 10px 8px;
    padding: 10px 5px 0 5px;
#styled option {
    padding: 2px 15px 2px 12px;
#styled optgroup option {
    padding-left: 22px;
#optA   {
    color: white;
    background-color: black;
#optA:hover {
    color: black;
    background-color: orange;
#optB   {
    background-image: url("../images/facebook.png");
    background-position: top right;
    background-repeat: no-repeat;
#optB:hover {
    background-image: url("../images/dzone.png");
#optB   {
    color: blue;
#optB option:nth-of-type(odd) {
    background-color: aqua;
#optB:hover option:nth-of-type(odd) {
    color: red;
 HTML: ;