gpt4 book ai didi

html - anchor 标记不适用于悬停 css

转载 作者:行者123 更新时间:2023-11-28 04:54:21 25 4
gpt4 key购买 nike

我遇到了这个奇怪的问题,出于某种原因,我的 anchor 标记在悬停或事件状态下不起作用。

<span class="subHeaders">
<a href="" />First </a>
</span>

<span class="subHeaders">
<a href="" />Second </a>
</span>

<span class="subHeaders">
<a href="" />third </a>
</span>


// css
.subHeaders a:link {
text-decoration: none;
}

.subHeaders a:active {
color: yellow;
}
.subHeaders a:hover{
cursor: pointer;
color: red;
}

副标题 a:link 类仅有效,悬停和事件无效。

最佳答案

您使用的 HTML 中有错误 <a/></a>你应该使用 <a></a> .使用这个:

<span class="subHeaders">
<a href="" >First </a>
</span>

<span class="subHeaders">
<a href="" >Second </a>
</span>

<span class="subHeaders">
<a href="" >third </a>
</span>

关于html - anchor 标记不适用于悬停 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26056311/

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