S
S
svilkov872015-11-08 19:22:11
css
svilkov87, 2015-11-08 19:22:11

List items in different background?

Hello!
There is a list of three items. on hover, the first item should be orange, the second should be green, and the third should be yellow. How to do this with CSS?
Thank you.
The code

<li><a href="#">оранжевый</a></li>
<li><a href="#">зеленый</a></li>
<li><a href="#">желтый</a></li>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Kirill, 2015-11-08
@GoooodBoy

nth-child - google this and you will be happy.

S
Sergey Goryachev, 2015-11-08
@webirus

li:nth-child(1):hover { background: #111; }
li:nth-child(2):hover { background: #222; }
li:nth-child(3):hover { background: #333; }

D
Dmitry, 2015-11-08
@soledar10

you can also do this jsfiddle.net/soledar10/z0e4ata1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question