How to change the select box option background color with CSS?

Spread the love

Sometimes, we want to change the select box option background color with CSS.

In this article, we’ll look at how to change the select box option background color with CSS.

How to change the select box option background color with CSS?

To change the select box option background color with CSS, we set the background property.

For instance, we write

select option {
  margin: 40px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

to set the option elements’ background color with background: rgba(0, 0, 0, 0.3);.

Conclusion

To change the select box option background color with CSS, we set the background property.

Leave a Reply

Your email address will not be published. Required fields are marked *