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 Unused CSS Stages Flexbox and Multi-Column Layout Flexbox: Part 1

No overflow for my flexbox.

Hello, at the end of video, before using the function -webkit-flex-wrap: wrap; Guil show that the list item are not wrapped inside the nav class: in fact the overflow!

When I've tried this in my computer, and resize the browser my elements stay inside the nav.

Question: Is it possible that with new Chrome version there is no more overflow for flexbox? If not, why my list items don't overflow as in the video?

Thanks in advance.

My current version of Chrome is v. 39.0.2171.95.

Devin Harris
Devin Harris
9,693 Points

Dario. It may be helpful if you post the snippet of code you are talking about.

1 Answer

Matt Varner
Matt Varner
5,373 Points

TL:DR? - I may have solved this mystery...please see the latter part of this post for the solution (that works in my Chrome now)

Devin, I'm certain that the code Dario is referring to is the following:

Flexbox Wrap syntax

Snippet: .nav { display: -webkit-flex; -webkit-flex-direction: row; -webkit-justify-content: space-between; -webkit-flex-wrap: wrap; }

This CSS snippet is styling a nav element made up of several unordered list items, converting it to a 'flexbox.' In the lesson, Guil Hernandez says the following:

"In our HTML file, if we add more list items to our unordered list, we can see how the boxes are still evenly distributed on the page. I'll go ahead and remove these auto margins here so we can see how the space is still evenly distributed between all six list items. They are, however, not wrapping within the flex container. As we can see here, they are overflowing. We can easily take care of that with the "flex-wrap" property."

The following images (if my meager Markdown skills are not too faulty) illustrate the issue of the flexbox items not overflowing by showing how it should look (the Codepen GIF), and how it is behaving in Chrome (my version is 40.0.2214.111 m)

GIF - Codepen Wrap Working

GIF - Chrome Flexbox Overflow Not Present

Since the flexbox is not, in fact, overflowing...the wrap syntax is not doing anything at all, and it's a little confusing whether or not there should be new syntax to compensate for the change. I'll be looking for a solution, but maybe this will help flesh out the problem, I'm hoping.

:: crosses fingers ::

Edit: There does seem to be some issues related to how overflow behaves in Chrome and maybe even Firefox. A very non-exhaustive list of information that I am beginning to find about the subject is:

+Chromium -webkit-flex disables overflow: hidden +Flexbox Regression: Text overflow broken for flex items

Edit: SUCCESS - It seems that a current workaround is to include the following code alongside the other flexbox declaration elements:

Image

Snippet to use in your element:
min-width: 0;

I just tried it in Chrome and I am now seeing the expected behavior. Here's the GIF:

Eureka