Sorry if this question already exists, but I didn't manage to find it. I am wondering why img:after in CSS is not working. I tried setting the display of the img to be block and what not, but it refuses to work every time...Any ideas? I am trying to place a background image after an image (for oldschool shadow), but it works only if I place the image in a div/span.
That's what I've been trying to run:
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Exercise2</title>
<link rel="stylesheet" type="text/css" href="exercise2.css">
</head>
<body>
<div id="container">
<img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSJxP3c9QZ--VxiX0M1p9shvBa0KDLGjTjlqC3V4ygH_zA6vn-Bvw">
</div>
</body>
</html>
CSS:
#container {
width: 100%;
}
img {
display: block;
}
.shadow:after {
display: block;
position: absolute;
right: 0;
top: 0;
top: 10%;
content: "";
height: 90%;
width: 6px;
background: url(pictures/shadow_side.png) repeat-y 0% 0%;
}