问题
It appears to me that Chrome does not treat "before" pseudoelement as a part of an element. More precisely, I have CSS definition
.myclass:before{content:"A";}
and HTML code
<a href="blah" class="myclass">B</a>
In Chrome the result is a hyperlink "AB" but only "B" is actually clickable. In Firefox and Opera the whole "AB" is a link, and my reading of CSS standard indicates that Chrome is wrong here.
Am I right in assuming that this is Chrome's bug? Is there a simple and clean workaround?
回答1:
It seems that you can work around it with:
.myclass {
display: inline-block
}
http://jsfiddle.net/SUKYw/
Looks like a Chrome bug - Safari does not have the same problem.
来源:https://stackoverflow.com/questions/6480495/before-pseudoelement-in-chrome