gpt4 book ai didi

CSS Sibling/Tilde 作为按钮 "animation"

转载 作者:太空宇宙 更新时间:2023-11-04 15:40:24 28 4
gpt4 key购买 nike

这样的事情可能吗?

<style>  
a,
a:active~a.active {
color:#000;
background:#fff;
}
a.active,
a:active {
background:#000;
color:#fff;
}
</style>

此 CSS 代码已应用,但被 a.active 本身覆盖。我尝试了 !important,但这也会覆盖 a.active!

演示:http://jsfiddle.net/77eP4/

最佳答案

a:active~a.active仅适用于 a.active a:active 之后的元素元素。没有将样式应用于 a.active 的选择器a:active 之前的元素.你不能用 !important 解决这个问题任何一个;你需要 JavaScript。

关于CSS Sibling/Tilde 作为按钮 "animation",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12220032/

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