我正试图在 img
元素上使用 :before
伪元素。
考虑以下 HTML 和 CSS...
HTML
<img src="http://0.gravatar.com/avatar/this-is-not-a-hash" alt="" />
CSS
img:before {
content: "hello";
}
这在 Chrome 13 和 Firefox 6 中不能产生期望的效果。然而,它可以与 div
或 span
元素一起使用。
为什么呢?
有没有办法让伪元素与 img
元素一起工作?