I'm a CSS newbie looking to enhance my simple responsive hero grid by adding a banner with white text and 0.5 opacity at the center-right.
https://i.sstatic.net/qoQic.jpg
Check out my CodePen example here.
.hero-section {
display: grid;
grid-template-columns: 1fr; // stretch to the full frame
grid-column-gap: 0px;
grid-row-gap: 0px;
align-content: center;
justify-content: center;
.banner-image-div {
grid-area: 1 / 1 / 2 / 2;
} // image
.banner-overlay-div {
grid-area: 1 / 1 / 2 / 2;
} // gradient or other overlay
.banner-text-div {
grid-area: 1 / 1 / 2 / 2;
}
}
.hero {
display: grid;
min-width: 350px;
width: 100%;
height: 968px;
object-fit: cover;
}
.hero-rectangle {
width: 100px;
height: 250px;
opacity: 0.5;
background-color: #fffff;
position: absolute;
}
<section class="hero-section">
<div class="row" style="padding: 0 15px; margin: 0px auto; background-color: #fff">
<div class="col-sm-12">
<div class="banner-image-div">
<img src="https://source.unsplash.com/random" alt="" class="hero" />
<div class="hero-rectangle">
<p>Text here </p>
</div>
</div>
</div>
</div>
</section>
I've been struggling to position it above the hero image. Any tips on how I can achieve that? Thanks!