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 Flexbox Layout Building a Layout with Flexbox Building a Navigation Bar with Flexbox

Another possible solution

@media (min-width: 769px) {
  .main-nav {
    display: flex;
    justify-content: center;
  }
}

@media (min-width: 1025px) {
  .main-header,
  .main-nav {
    display: flex;
  }
  .name {
    margin-right: auto;
  }
}

I came up with this code and it seems to work. Is it correct, are there any further problems I can run into using this piece of code?

1 Answer

Steven Parker
Steven Parker
231,271 Points

There's rarely just one way to program anything, so there will usually be alternate ways to accomplish the same task.

Your version does make a slight change to the alignment of the nav items, as the original aligned their baseline with the heading on a wide window, and yours aligns them vertically within the space.

It's a matter of taste, but I actually think yours looks nicer. :+1: