Bummer! You must be logged in to access this page.

Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Flexbox: 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

Have 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.

Ah 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

No problem. Have a nice day!