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
Robbie Singh
3,675 PointsHow can I ensure that my nav li items are centered on the page?
nav { background: #4b0082; }
nav ul { list-style: none; margin: 0px 0px 50px 0px; padding: 0px; }
nav li { display: inline-block; }
nav a { font-weight: 900; padding: 30px 20px; }
2 Answers

Robert Richey
Courses Plus Student 16,352 PointsHi Robbie,
There are many ways to go about this - one way is to center the ul element with a text-align: center
. Here's a Codepen using your code. I just centered the ul and made li text white.
Robbie Singh
3,675 PointsThanks Robert! That worked perfectly.