0
<div>
<ul>
<li>Do something with this element</li>
<li></li>
</ul>
<ul id="someId">
<li>This element:hover</li>
<li></li>
</ul>
</div>

I wonder if it is possible to select the first li element of the first ul if I hover on the first li element of the second ul element.

I've tried selectors like:

#someId li:first-of-type:hover:parent:parent ul:first-of-type li:first-of-type

But it obviously doesn't work. I want to avoid using JavaScript and changing the HTML structure is not an option. Adding classes and IDs isn't a problem.

Is this selector possible with CSS3?

BoltClock
  • 630,065
  • 150
  • 1,295
  • 1,284
Wouter
  • 430
  • 2
  • 5
  • 12

1 Answers1

0

Without JS you can't change dom elements. At first give id or class to ul, after it use jquery .hover () function. And use first-child element for getting li of ul.

Hayk Manasyan
  • 508
  • 2
  • 19