My goal is to use some CSS tricks to add dark overlay with 50% opacity to jumbotron background image to make it darker.
I've tried to use :before CSS selector to add dark rectangle in front of jumbotron which works fine on normal jumbotron class, however using the same method on fluid jumbotron, makes content and button in container covered and unreachable.
My HTML and CSS code. Currently I'm using Bootstrap 4 classes.
.jumbotron {
position: relative;
background: url(https://source.unsplash.com/7bzbyafVTYg/1920x1080) no-repeat bottom center / cover;
}
.jumbotron:before {
position: absolute;
content: '';
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 51, 153, 0.8);
}
.jumbotron .container {
padding: 100px 0;
}
.jumbotron h1,
.jumbotron .lead {
color: #fff;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="jumbotron jumbotron-fluid mb-0 text-center">
<div class="container">
<h1 class="display-4">MAIN PAGE</h1>
<a class="btn btn-primary btn-lg mt-" href="#sec-pricing" role="button">Learn more</a>
</div>
</div>