使border-bottom
在懸停時消失。使用虛擬邊框將邊框底部消失
<a id="toggle" href="#modal0">living in New York,</a>
#toggle {
transition: all .3s ease-out;
position: relative;
}
#toggle::after{
content:'';
position:absolute;
width: 100%;
height: 0;
left:0;
bottom: 4px; /* <- distance */
border-bottom: 2px solid #000;
}
#toggle::after:hover{
transition: all .3s ease-out;
border-bottom: solid transparent 1px
}
更改僞懸停的建議
#toggle:hover::after{
border-bottom: 1px transparent #999;
transition: all .3s ease-out;
}
@ user2252219已更新。 – ryachza
嗯。我放棄了這一步,但似乎沒有生效。我添加到OP我放什麼:) :) – user2252219
@ user2252219我認爲這個問題可能是'透明#999'。這是什麼似乎爲我工作:http://jsfiddle.net/3uap9bo6/ – ryachza