I am trying to add a gray bar across an image using css :after
When I try the below the image appears, but not the red box. If I replace the image with a p tag with the same class then it works as expected.
Why can't I see the red box on top of the image?
<div id="wrapper">
<img class="grayborder" src="mad-dogs-eyes.jpg" height="450" width="322" alt="two mad dogs " />
</div>
css:
#wrapper {
width:1000px;
margin:0 auto;
position:relative;
z-index:100;
}
img:after {
content: "";
position:absolute;
width:100px;
height:100px;
background-color:red;
top:100px;
right:10px;
z-index:1001;
}