Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS CSS Flexbox Layout Building a Layout with Flexbox Creating a Two Column Layout with Flexbox

daniel steinberg
daniel steinberg
14,651 Points

Primary and Secondary Column width

Before adding "flex: 1:" and "flex: 2;" to the media queries, why does the Primary take up 2x the width of Secondary at 769 min width? Why are they not the same width? I see nothing in base.css that would cause this. Thanks

2 Answers

Jamie Reardon
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jamie Reardon
Treehouse Project Reviewer

The primary column has more content than the secondary column. By default, it will obviously take more width than the secondary column because of this.

They both share the class col, and therefore, the teacher adds flex: 1 to the 769px media query. By adding this css property, the two columns become of equal width.

Alex Francis
Alex Francis
10,215 Points

Interestingly, I tried commenting out and deleting some of the text from the primary column, and the original layout remained.

It makes sense to me that the flex container .row would decide how wide each flex item should be based on overall text amount: it would over-spill horizontally so that each flex item (primary & secondary) take up the same amount of vertical space in the row.

So I'm also confused as to why this then doesn't change if I take away some of the text from the primary column. I'm left with some white space after the content of the primary column, and the primary still takes up more horizontal space than the vertical.

Does anyone know why this is?