How to hide a option in a select menu with CSS?

Sometimes, we want to hide a option in a select menu with CSS.

How to hide a option in a select menu, we will look at in this article with CSS.

How to hide a option in a select menu with CSS?

We can add the hidden to hide a option in a select menu to attribute to the option element we want to hide with CSS.
For instance, we can write

<select>
  <option>Option1</option>
  <option>Option2</option>
  <option hidden>Hidden Option</option>
</select>

By adding the hidden attribute to the last option element to hide the last option.

Conclusion

With CSS, we can add the hidden to hide a option in a select menu to attribute to the option element we want to hide.

Leave a Reply