We would like to know how to using :before and :after to apply multiple background images.
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.mydiv {<!--from www .ja v a 2 s.co m-->
position: relative;
width: 70%; /* flexible width */
height: 200px;
background: #efefef;
}
.mydiv:before, .mydiv:after {
content: '';
position: absolute;
top: 0;
}
.mydiv:before {
left: 0;
width: 50px;
height: 70px;
background: red;
}
.mydiv:after {
right: 50px;
width: 50px;
height: 70px;
background: blue;
}
</style>
</head>
<body>
<div class="mydiv"></div>
</body>
</html>
The code above is rendered as follows: