[英]CSS Why overline doesn't change color and style on hover?
我正在嘗試做一個鏈接,當您:hover出現的輪廓線與文本的顏色不同時,以下代碼對我來說似乎是正確的,但是不起作用,我也不知道為什么:S
.subboto a:hover {
text-decoration: overline;
text-decoration-color: #f7a319;
text-decoration-style: dashed;
}
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: ' ';
}
在這里查看更新的小提琴: https : //jsfiddle.net/ytq235an/6/
似乎只有Firefox支持。 w3schools文字裝飾風格
如果您希望將懸停在div上方時顯示上划線
.subboto:hover {
text-decoration: overline;
text-decoration-color: #f7a319;
text-decoration-style: dashed;
}
谷歌快速搜索將我帶到了本教程: http : //www.w3schools.com/cssref/css3_pr_text-decoration-color.asp
我單擊“自己嘗試”按鈕,但下划線不是應該的紅色。 文字指出,任何主流瀏覽器均不支持該功能,但是firefox確實具有自定義選項。
除非您只在firefox上工作,否則您將不得不以其他方式進行操作
參考此圖片: http : //i.stack.imgur.com/qbTXE.png
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.