gpt4 book ai didi

html - CSS 为什么上划线在悬停时不会改变颜色和样式?

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

我正在尝试做一些链接,当你 :hover 出现一个颜色与文本颜色不同的上划线时,这里的代码对我来说似乎是正确的,但不起作用,我不知道为什么 :S

.subboto a:hover {
text-decoration: overline;
text-decoration-color: #f7a319;
text-decoration-style: dashed;
}

JSFiddle

最佳答案

text-decoration-color 仅在 Firefox 和 Safari 中受支持。看看这里的文档,https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-color

如果你想这样做,你可以这样做

.subboto a:link, a:visited {
text-decoration: none;
color: black;
position: relative;
}

.subboto a:hover:after {
position: absolute;
top: 0;
left: 0;
width: 100%;
border-top: 1px dashed #f7a319;
content: ' ';
}

在这里查看更新后的 fiddle :https://jsfiddle.net/ytq235an/6/

关于html - CSS 为什么上划线在悬停时不会改变颜色和样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29835549/

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