开发者

Rollover child changes parent

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜