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

How do I make this centered and on one line in CSS?

I must have missed something. I am currently doing the portfolio making html/css tutorials and I can't figure out what I missed to get the about and contact links to center and be on the one line. What code takes a unordered list and puts it flush with itself and centered on the page?

Which course? Can you provide a link? Can we see your code?

1 Answer

Jacob Herper
Jacob Herper
94,150 Points

Hi,

This should work:

ul{ text-align:center; } li{ display: inline-block; }

The elements inside < ul > have to be centered, but to make this work the < li > elements have to be displayed as inline elements, rather than block elements. This is what the above CSS should do for you.