Leave the select colored

Asked

Viewed 107 times

0

I have the following select:

<select>
    <option>opção1</option>
    <option>opção2</option>
    <option>opção3</option>
    <option>opção4</option>
    <option>opção5</option>
</select>

I would like to make it colored. for example:

opção1: cinza
opção2: branco
opção3: cinza
opção4: branco
opção5: cinza

Being that I don’t know how many options you can have (at any time may be added another option)

How can I do that? Thank you.

  • Do you have any idea what you can do? In CSS there is a selector nth-child, you know? Want to try?

  • Add onclick event in select and then check with with if and then change color with some class or id in css.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.