[英]a:hover in span tag, how to remove hover style
a:hover { text-decoration:underline; }
<div> <ul> <li> <a> <span class="title1"> title1 </span> title2 is hover underline </a> </li> </ul> </div>
如何刪除僅標題1的懸停樣式。
title1不帶下划線,title為帶下划線;
a:hover {text-decoration:underline;} .title1 { display: inline-block; vertical-align: top; } a:hover .title1 { text-decoration:none; }
<div> <ul> <li><a><span class="title1">title1</span>title2 is hover underline</a></li> </ul> </div>
您可以將偽元素與:before一起使用
a { font-weight: 300; display: inline-block; padding-bottom: 2px; position: relative; } a:hover:before{ content: ""; position: absolute; width:85%; height: 1px; left:18%; bottom: 0; border-bottom: 1px solid red; }
<div> <ul> <li><a><span class="title1">title1</span>title2 is hover underline</a></li> </ul> </div>
Try to this link:https://jsfiddle.net/17d80ym3/12/
這也可以給出正確的結果
您實際上是在告訴您的鏈接帶有下划線的文字。 使用a:hover {text-decoration:none;}要在鏈接中設置跨度樣式,您可以更深入:例如a:hover span {color:blue;}。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.