I'm trying to overlay an h1 over an image, using Grid;
for better contrast, I thought about using filter:brightness(80%)
on the image, which, unfortunately, removes the h1 altogether.
Is there any workaround to this? ( without pasting in image URLs in CSS)
(filter
is commented for you to apply and see)
body{
background: grey;
margin: 10px;
color: white;
text-align: center;
}
img{
max-width: 100%;
max-height: 100%;
}
.gridcontainer{
display: grid;
grid-template-columns: 1fr 1fr;
grid-gap: 10px;
max-width: 100vw;
align-items: center;
}
.griditem{
background: black;
}
.headingcover{
grid-column: 1/3;
grid-row: 1/2;
/* filter: brightness(80%); */
}
h1{
grid-column: 1/3;
grid-row: 1/2;
}
<div class="gridcontainer">
<img src="https://source.unsplash.com/7TGVEgcTKlY" alt="" class="headingcover">
<div class="griditem b">b</div>
<div class="griditem c">c</div>
<div class="griditem d">d</div>
<h1>Foxy</h1>
</div>