我试图用一个:before伪元素与img元素.
考虑这个HTML和CSS ......
<img src="http://0.gravatar.com/avatar/this-is-not-a-hash" alt="" />
Run Code Online (Sandbox Code Playgroud)
img:before {
content: "hello";
}
Run Code Online (Sandbox Code Playgroud)
这不会产生预期的效果(在Chrome 13和Firefox 6中测试).但是,它适用于a div或span元素.
为什么不?
有没有办法让伪元素与img元素一起使用?