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!
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

Benjamin Hedgepeth
5,672 PointsHorizontal nav won't center
I don't know what I'm doing wrong here. Centering the nav won't work for a reason I can't find.
<header class="siteHeader">
<div class="wrap">
<h1 class="siteHeading">WebDev</h1>
<nav class="siteNav">
<ul class="linkTo">
<li><a href="#">AA</a></li>
<li><a href="#">BB</a></li>
<li><a href="#">CC</a></li>
<li><a href="#">DD</a></li>
<li><a href="#">EE</a></li>
<li><a href="#">FF</a></li>
<li><a href="#">GG</a></li>
</ul>
</nav>
</div>
</header>
* {
box-sizing: border-box;
}
.wrap {
width: 70%;
margin: 0 auto;
}
.linkTo {
list-style: none;
padding: 0;
margin: 0;
}
/**********************
HEADER
***********************/
.siteHeading {
text-align: center;
}
.siteNav,
.linkTo,
.linkTo li {
display: inline-block;
}
.siteNav {
text-align: center;
}
2 Answers

Konrad Pilch
2,435 PointsI think you need to marign 0 this <header class="siteHeader"> and give it a container.

Tim Wall
9,570 PointsOne way you can get your horizontal nav to center is to replace the selected class of .siteHeading with .siteHeader. That way everything inside the header div will inherit the property value {text-align: center;} so long as it is not overridden later.
Benjamin Hedgepeth
5,672 PointsBenjamin Hedgepeth
5,672 PointsI noticed that if I keep .'siteNav' in the rule where inline-block is applied I need a new rule of
or I can omit '.siteNav' from the rule where the display mode is changed to include only the unordered list and list items.