Im doing a website, and there is a fixed background image, and above this image there are some scrollable element. I want to apply a grayscale filter on the image, it works, but unfortunately this filter is applied also to the container text, so also the text is gray, but i dont want that. I wan only that the image has a grayscale, not the above element. How can solve this problem?
This is bootstrap code:
<section id="section-toTheTop"
class="jumbotron jumbotron-fluid fixed-background d-flex justify-content-center align-items-center">
<div class="container text-center">
<h1 class="display-1 text-primary">PHOTOSERVICE</h1>
<p class="display-4 d-none d-sm-block text-white">Capture every moment</p>
<p class="lead text-white">Create stunning photos and videos by using the built-in features for enhancement.</p>
<p class="lead text-white">Share your best shots with your friends and the rest of the world instantly.</p>
<p><strong class="text-white">Download now on:</strong></p>
<a href="#" class="btn btn-primary btn-lg"><i class="fab fa-fw fa-apple"></i> App Store</a>
<a href="#" class="btn btn-primary btn-lg"><i class="fab fa-fw fa-google-play"></i> Play Store</a>
</div>
</section>
This is css code:
.fixed-background {
background-image: url("img/background.jpg");
background-size: cover;
background-attachment: fixed;
background-position: center;
min-height: 100vh;
filter: grayscale(100%);
}
@Hibrit Usta, at the end, playing with z-index, i used this trick:
<div class="overlay"></div>
<section id="section-toTheTop"
class="jumbotron jumbotron-fluid fixed-background d-flex justify-content-center align-items-center">
<div class="container text-center text-over-image">
<h1 class="display-1 text-primary">PHOTOSERVICE</h1>
<p class="display-4 d-none d-sm-block text-white">Capture every moment</p>
<p class="lead text-white">Create stunning photos and videos by using the built-in features for enhancement.</p>
<p class="lead text-white">Share your best shots with your friends and the rest of the world instantly.</p>
<p><strong class="text-white">Download now on:</strong></p>
<a href="#" class="btn btn-primary btn-lg"><i class="fab fa-fw fa-apple"></i> App Store</a>
<a href="#" class="btn btn-primary btn-lg"><i class="fab fa-fw fa-google-play"></i> Play Store</a>
</div>
</section>
.fixed-background {
background-image: url("img/background.jpg");
background-size: cover;
background-attachment: fixed;
background-position: center;
min-height: 100vh;
}
.overlay {
position: absolute;
min-height: 100%;
min-width: 100%;
left: 0;
top: 0;
background: rgba(0, 0, 0, 0.75);
}
.text-over-image {
z-index: 0
}