I have a grid made of two elements, an image and some text.
.card {
width: 100%;
display: grid;
grid-template-columns: 60% 40%;
grid-template-rows: 50vw;
grid-template-areas:
"a b"
}
.card-text {
grid-area: a;
background-color: #02B277;
}
.card-text p {
width: 70%;
margin: auto;
top: 10rem;
font-weight: 500;
}
.image {
background: url('img/placeholder.jpg');
background-size: cover;
grid-area: b;
}
<div class="card">
<div class="card-text">
<p>Lorem ipsum blablabla</p>
</div>
<div class="image">
</div>
</div>
When the window gets shrunk horizontally, the text, which has a fixed font-size
, automatically expands vertically, overflowing the div. How can I make the grid-template-rows expand in order to enclose the text? I already tried setting it to auto
but it just follows the proportions of the image.