ImageGrid/ui/experiments/css-overlay.html

48 lines
753 B
HTML
Raw Normal View History

<style>
.image, .overlay:after, .elem-overlay {
width: 350px;
height: 350px;
}
.image {
position: absolute;
top: 50px;
left: 50px;
background: no-repeat 50% black;
background-size: contain;
background-image: url('../images/350px/DSC_3506.jpg');
/* this sets the opacity on both the image and :after */
opacity: 0.5;
}
.overlay:after, .elem-overlay {
display: block;
content: '';
position: absolute;
background: no-repeat 50% blue;
background-size: contain;
/* sets the opacity only for the :after */
opacity: 0.5;
}
.image:nth-child(2) {
display: inline-block;
left: 500px;
}
</style>
<div class="image overlay"></div>
<div class="image"><div class="elem-overlay"></div>