gpt4 book ai didi

css - 如何让 sibling 的 child 互相回应?

转载 作者:行者123 更新时间:2023-11-28 13:39:36 24 4
gpt4 key购买 nike

<ul>
<li><a href="#">meh</a></li>
<li><a class=target>aha!</a></li>
</ul>

meh 专注于

时,此 CSS 有望允许 aha! 发生变化
li a:focus ~ li a.target {

}

当然它不起作用,因为它期待 a:focus ~ li 而不是 li a:focus

我试过 li>a:focus ~ li a.target 但它似乎犯了同样的错误,有没有办法将它们分组以便它们产生请求的响应?似乎没有办法选择父级并在层次结构中爬行...

最佳答案

There doesn't seem to be a way to select a parent and crawl through the hierarchy...

不幸的是,没有办法做到这一点。

我不确定你到底想要什么,但也许就是这样:

ul li:first-child:hover + li .target {
color: red;
}

http://jsfiddle.net/thirtydot/XXZLM/

关于css - 如何让 sibling 的 child 互相回应?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8263289/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com