You cannot use :before or :after on img in CSS

Though the W3C even gives it as an example Show archive.org snapshot , no browser actually supports this CSS:

img:before {
  content: "something";
}

Browsers will simply not render anything when doing that on images (Fun fact: It worked in an older version of Opera but got dropped).\
The same applies to the :after pseudo-element.

This makes me sad.

You can try using jQuery instead.

Arne Hartherz Almost 12 years ago