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 CSS Layout Techniques Flexbox Layout Flexbox Layout Challenge

Jason Brown
Jason Brown
8,492 Points

Cannot figure this one out?!

Next, use the flexbox property and value that gives every list item inside main-nav evenly distributed widths.

@media (min-width: 611px) {

    /* Complete the challenge by writing CSS below */
.main-nav {
   display: -webkit-flex;
   display: flex;
   height: 100%;
  }
.main-nav li {
  -webkit-align-self: center;
  align-self: center;
  -webkit-flex-grow: 1;
  flex-grow: 1;
  margin-left: 8px;
  margin-right: 8px;

}

}

3 Answers

Chase Lee
Chase Lee
29,275 Points

Take out everything in main-nav li except for flex-grow: 1;. You only need that because "Flex" is made to be able to work on it's own without all of the margin and align stuff.

Hope that helps!

Chase Lee
Chase Lee
29,275 Points

You also don't need the height: 100%; or the display: -webkit-flex; in there.

Chase Lee
Chase Lee
29,275 Points

Looks like Adam got to it before me...:smiley: I guess I better read the page before I go finishing off my answers.:relaxed:

Adam Moore
Adam Moore
21,956 Points
@media (min-width: 611px) {

    .main-nav{
    display: flex;
  }

  .main-nav li{
    flex-grow: 1;
  }


}

The "flex-grow" property sets each item equally spaced, giving each item a value of "1". As long as each of the list items has the same "flex-grow" value, they will be evenly spaced.

Jason Brown
Jason Brown
8,492 Points

Thanks, I guess I tried to overthink it