Andrew Dickens
18,352 PointsFlexbox: Make all flexitems the same height?
Having problems where i have an img next to some text in a flexbox. The text has a background-color and I want that to run all the way down in line with the img bottom, What happens is the background-color stops where the text stops?
I've tried setting the height, placing extra divs but cant get it to nudge down. Any ideas? Thanks Andrew
<div class="row-container">
<div class="flex-item15">
<img src="img/gym2.jpg">
</div>
<div class="col-container flex-item05 back-color">
<h >Indian texts: UFO Giorgio sanskrit magnetic current</h2>
<p>I know it sounds crazy... Space brothers, legendary times targeted mutation vimana. The vedas SETI sky people DNA manipulation ancienj</p>
</div>
</div>
.row-container {
display: flex;
flex-direction: row;
justify-content: space-between;
}
.flex-item15{
flex: 1.5;
align-self: flex-start;
}
.col-container {
display: flex;
flex-direction: column;
}
.flex-item05 {
flex: 0.5;
align-self: flex-start;
}
.back-color {
background-color: $red-berry ;
}
2 Answers
Jesus Mendoza
23,289 PointsHave you tried to stretch the flexbox item?
in the child item
align-self: stretch;
or in the parent container
align-items: stretch;
If you want to learn more about Flexbox you can checkout the CSS Flexbox Layout Course. Your specific question is covered in Aligning Flex Items.
Andrew Dickens
18,352 PointsAh yes, I changed
.flex-item05{ align-self: flex-start}
to
.flex-item05{ align-self: stretch}
and that seems to have done the trick, thanks Jesus
Jesus Mendoza
23,289 PointsNo problem. Have a nice day!