I'm currently working on a new webpage and have found the perfect background image. However, I would like to add an overlay to darken the image. Unfortunately, the overlay doesn't cover the entire page!
Despite my attempts, I haven't been successful in resolving this issue. Here is my current HTML and CSS code:
/* //////////////////////// [ Background ] //////////////////////// */
body, html
{
height: 100%;
background-color: #fff;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.bg-img
{
background-image: url("../../images/background/bg.jpg");
display: block;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.overlay
{
position: relative;
z-index: 1;
width: 100%;
min-height: 100vh;
}
.overlay::before
{
content: "";
display: block;
position: absolute;
z-index: -1;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: rgba(0,0,0,0.8);
}
<div class="bg-img"></div>
<div class="overlay"></div>
If anyone could help me achieve the desired effect of having the overlay cover the full page, that would be greatly appreciated.