2016-01-27 74 views

回答

1

僞元素是理想在這裏它可以在任何你想要的時尚,顏色風格,寬度&高度......甚至低於位置鏈接文本。

a { 
 
    position: relative; 
 
    text-decoration: none; 
 
} 
 
a::after { 
 
    content: ""; 
 
    position: absolute; 
 
    top: 100%; 
 
    right: 0; 
 
    width: 75%; 
 
    height: 2px; 
 
    background: orange; 
 
}
<a href="#">Long stretch of text</a>

1

你可以試試這個:

a{ 
    text-decoration: none; 
    display:inline-block; 
} 

a:after{ 
    content: ""; 
    border-bottom: dotted 2px red; 
    width: 70%; 
    float: right; 
    padding-top: 5px; 
} 

https://jsfiddle.net/9xc0x58c/1/

1

你可以使用一個僞元素,即:元素之後,這和ABS POS它,1px的高背景顏色和選擇,你寬鏈路長度等 請問這是所需的結果?不確定爲什麼你會想要這個,但它應該達到要求的結果。

1

可以使用跨度

HTML

<a href="">Link <span class="un">very cool name</span></a> 

CSS

.un{ 
border-bottom: dotted 2px red; 
    }