How to put an image in div with CSS?

This answer by Jaap :

<div class="image"></div>​

and in CSS :

div.image::before {
   content:url(http://placehold.it/350x150);
}​

you can try it on this link :
http://jsfiddle.net/XAh2d/

this is a link about css content
http://css-tricks.com/css-content/

This has been tested on Chrome, firefox and Safari. (I’m on a mac, so if someone has the result on IE, tell me to add it)

Leave a Comment