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 trialCarl-Kaspar Puhm
Front End Web Development Techdegree Student 8,692 PointsStuck with center aligning navigation.
I'll add my workspace.
In css, in the media query, i am trying to center align my navigation. No luck tho.
I've been playing around with : margin, text-align and display properties. no luck tho.
3 Answers
Carl-Kaspar Puhm
Front End Web Development Techdegree Student 8,692 Pointsi just messed up with some css in my main.css file.
so for some reason i used a float, where it is not needed at all.
this piece of code helped me out:
.nav {
text-align: center;
}
.nav li {
display: inline-block;
}
sorry for wasting your time, but i think these kind of mistakes in the beginning are the most common.
Sheryl Darroch
Treehouse Project ReviewerTry this:
.nav { display: inline-block; }
and keep the margin setting for the .nav ul as
margin: 0 auto;
Hope this helps! Keep trying. You will get it.
Artem Shturkin
Courses Plus Student 8,359 PointsHi , If you know about flexbox , try this :
@media screen and (min-width: 768px) {
/*style.css:165 in your css*/
.nav ul {
margin: 0 auto;
display: flex;
width: 350px;
justify-content: center;
}
}
if not learn about flexbox https://teamtreehouse.com/library/css-flexbox-layout
Carl-Kaspar Puhm
Front End Web Development Techdegree Student 8,692 Pointsnot familiar with flexbox and i will learn it, but found an easy solution for the problem.
Artem Shturkin
Courses Plus Student 8,359 PointsArtem Shturkin
Courses Plus Student 8,359 PointsClose the question by choosing the best answer.