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 to Make a Website CSS: Cascading Style Sheets Center the Wrapper

Center is not so center...

i did

html {text-align: center;}

Long story short the text wasn't all centered the same. Any reason?

What do you mean it wasn't all centred the same?

whoops... i posted answer instead of reply.. going total noob here. ~

Well i guess one line in relation to another looked as if it's center point was somewhat different.

What course is it in and what does the html look like?

2 Answers

A quick fix is to replace the html selector with a *. The * will apply the styling to all elements. Everything should be centred in it's respective wrapping element.

If there are individual elements that don't appear centred they likely have different dimensions, padding, margins, etc.

I'd start by using a * to see what happens and then work down to the individual elements.

*{ text-align: center; }

Ah.... I think i got it figured out!

Long story short... It was an unordered list with invisible bullet points which off-centered it. But made it visually appear center with the words from another list who's bullet points were all the way left on the screen.

p.s. thanks for the help