Read more

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

Arne Hartherz
May 10, 2012Software engineer at makandra GmbH

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

img:before {
  content: "something";
}
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

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.

Posted by Arne Hartherz to makandra dev (2012-05-10 23:03)