I have a grid with two columns. The second column has a larger font size:
.container {
display: grid;
grid-template-columns: max-content 1fr;
gap: 0.5rem;
}
.text1 {
color: #fff;
background-color: #000;
}
.text2 {
font-size: 3.75rem;
}
<div class="container">
<div class="text1">text1</div>
<div class="text2">text2</div>
</div>
I wanted to align the texts to the baseline so I added align-items: baseline; to .container and this happened:
The texts are aligned correctly but the black background doesn't take the whole grid block. How can I keep the text1 container stretched while aligning its content to baseline?
I've tried these but none of them worked:
- adding
height: 100%to.text1 - adding
align-self: stretchandalign-content: baselineto.text1 - a wrapper
divfor the background and aspanfor the content and settingalign-self: baselinefor thespan.

