How I design background image with overlay in CSS like this example image.
here the code. i want to add tour
class to background image and overlay effect. <
you should have added more information in to the question, but Is this what you want?
CSS for this:
.background {
background:url('BackgroundImage.png');
}
.layer {
background-color: rgba(248, 247, 216, 0.7)
width: 100%;
height: 100%;
}
HTML for this:
<div class="background">
<div class="layer">
</div>
Hope it helps :)
Try Below Code
HTML
<div class="img-wrapper">
<img src=".." />
</div>
Style
.img-wrapper {
position: relative;
}
.img-wrapper:after {
content: "";
background-color: rgba(37,131,173,0.5);
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
z-index: 1;
}
It goes something like this:
<style>
.div-image{
height: 200px;
width: 400px;
background-image: url(demo.jpg);
background-repeat: no-repeat;
}
.overlay{
height: 200px;
width: 400px;
position: absolute;
top: 0;
left: 0;
background: rgba(0, 0, 255,0.5);
}
</style>
<body>
<div class="div-image"></div>
<div class="overlay"></div>
</body>
you can use this code
HTML
<div id="wrapper">
<img src="image-file" alt="">
<div class="overlay"></div>
</div>
CSS
#wrapper {
position: relative;
}
.overlay {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background: rgba(0,0,0,.5);
z-index: 999;
}