Max*_*Max 12 html css pseudo-element
是否可以通过CSS 将a : pseudo元素添加到A html标记而不显示伪元素的下划线文本修饰?
在下面的标记中,在链接的左侧添加了一个"+"符号,它在鼠标上正确加下划线,但即使css规则设置为"h3 a:before:",伪符号"+"也加下划线.悬停{text-decoration:none;}"
<style>
h3 {
display:block;
margin:20px auto;
padding:6px;
width:85%;
text-align:left;
font: 21px 'lucida sans'; color:#444;
border-bottom:#ccc 1px solid;
}
h3 a{
margin:0; padding:8px 4px 0 0;
display:inline;
float:right;
width:auto;
text-decoration:none;
font: 14px 'lucida sans';
}
h3 a:hover{ text-decoration:underline; }
h3 a:before{ content: '+'; margin:0; padding: 4px; }
h3 a:hover:before{ text-decoration:none; }
</style>
<h3>My Title <a href="#">link</a></h3>
Run Code Online (Sandbox Code Playgroud)
Cli*_*int 21
设置:before元素显示:inline-block; 将使文本装饰:无; 样式.
h3 a:before{
display:inline-block;
content: '+';
margin:0;
padding: 4px;
text-decoration:none;
}
Run Code Online (Sandbox Code Playgroud)