Is there a way through pure CSS to change the style of a parent LI on the hover of a child LI?
<ul>
<li>
1
<ul>
<li>10</li>
<li> 20</li>
</ul>
开发者_如何学编程 </li>
<li>2</li>
</ul>
So that when I hover over 10 or 20, a style is applied to 1 or 2?
No, there is no parent selector in CSS.
See here for why this is the case:
http://snook.ca/archives/html_and_css/css-parent-selectors
In short: performance reasons.
精彩评论