How does Reddit display anchor tags as images?
Example here: http://www.reddit.com/r/fffffffuuuuuuuuuuuu/comments/fn9e7/the_best_thing_about_walking_to_scho开发者_运维知识库ol/c1h7af4
I tried to peek into the DOM via Firebug but I couldn't find a reference to the images. I only found that the href
attribute of the anchor tags decides what image will be displayed. This is something new to me. How does this work?
It's a CSS background-image
in the :after
pseudo-selector.
Like slaks says, it's a background image. Like so:
<a href="link.html" style="width:100px; height:100px; background-image:url('image.jpg');"></a>
精彩评论