ul { width: 200px; height: auto; } ul > li { width: 100%; height: 30px; background: #fff; list-style: none; border-bottom: 1px solid #999; position: relative; } span { display: block; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); } <ul> <li><span>firest</span></li> <li><span>second</span></li> <li><span>third</span></li> </ul> How to make the text change color when you hover over the first list item? And it needs to be done using pseudo-classes :nth-child() and :hover .
I understood how to change from the first, but I cannot continue and change from the second ..
ul > li:nth-child(1):hover { color: pink; }