I\'m trying to use the :before
selector to place an image over another image, but I\'m finding that it simply doesn\'t work to place an image before an im
Here's another solution using a div container for img while using :hover::after
to achieve the effect.
The HTML as follows:
The CSS as follows:
#img_container {
margin:0;
position:relative;
}
#img_container:hover::after {
content:'';
display:block;
position:absolute;
width:300px;
height:300px;
background:url('');
z-index:1;
top:0;
}
To see it in action, check out the fiddle I've created. Just so you know this is cross browser friendly and there's no need to trick the code with 'fake content'.