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 CSS Basics (2014) Understanding Values and Units Percentages

Konrad Dziekonski
Konrad Dziekonski
7,798 Points

text-align: center

http://w.trhou.se/ym0iq4vu0l

Hi!

If You cvould check out style.css file on the very bottom i'm enquiring about this part

.primary-content { text-align: center; }

.primary-content, .secondary-content { width: 60%; }

no matter which of these inputs goes first both primary and secondary content gets width of 60% of the screen and the alignment is to the left. Is it important which input goes first? Are the first ones suppesed to override the following ones, ot the opposite or how does it work? :) and why the primary content is not centered?

Thanks!

1 Answer

Steven Parker
Steven Parker
229,786 Points

The text inside of the "primary-content" container is centered within that container. That's what "text-align: center" does.

What you probably want to do is center that container in the window. That can be done with auto margins:

.primary-content { margin: 0 auto; }