gpt4 book ai didi

html - 匹配 anchor 和 div 悬停状态的选择器不匹配超链接

转载 作者:太空宇宙 更新时间:2023-11-04 00:55:36 25 4
gpt4 key购买 nike

我的页面标记如下:

<a href="#Products">
<div id="Tag">
<span>A website hyperlink</span>
</div>
</a>

#Tag {
opacity: 1;
filter: drop-shadow(0px 3px 6px rgba(0, 0, 0, 0.161));
position: absolute;
left: 50px;
top: 107px;
box-sizing: border-box;
margin: 0;
padding: 0;
overflow: visible;
width: 527px;
white-space: nowrap;
text-align: left;
font-family: Arial;
font-style: normal;
font-weight: bold;
font-size: 55px;
color: rgba(255,255,255,1);
}

如您所见,容器上明确设置了颜色。

我想在悬停时更改颜色。

a:hover {
color: red !important;
}

a:hover {
color: red !important;
}

#Tag {
opacity: 1;
position: absolute;
left: 20px;
top: 20px;
box-sizing: border-box;
margin: 0;
padding: 0;
overflow: visible;
width: 527px;
white-space: nowrap;
text-align: left;
font-family: Arial;
font-style: normal;
font-weight: bold;
font-size: 35px;
color: rgba(0,0,0,1);
}
<a href="#Products">
<div id="Tag">
<span>A hyperlink</span>
</div>
</a>

是否有另一个选择器来匹配这个超链接标记?

最佳答案

a:hover * {
color: red !important;
}

#Tag {
opacity: 1;
position: absolute;
left: 20px;
top: 20px;
box-sizing: border-box;
margin: 0;
padding: 0;
overflow: visible;
width: 527px;
white-space: nowrap;
text-align: left;
font-family: Arial;
font-style: normal;
font-weight: bold;
font-size: 35px;
color: rgba(0,0,0,1);
}
<a href="#Products">
<div id="Tag">
<span>A hyperlink</span>
</div>
</a>

关于html - 匹配 anchor 和 div 悬停状态的选择器不匹配超链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54847450/

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