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 trialMaya Shen
7,056 PointsHow did the .main-footer {text-align: center;} make all container centered in this page?
I notice there is no center property in .container to align contents of header and section in center of their parent box. Only text-align: center was set in main-footer. And in my practice followed the steps in this tutorial, the contents of header and section lay on the left.
Andrei Duhanes
14,155 PointsAndrei Duhanes
14,155 PointsThe reason he used text-align:center to center the text in the footer is because it's full width of 100%. The container has 70% width so the way to make it center is to add margin: 0 auto like this.
.container { width: 70%; margin: 0 auto; (meaning it distributes equal space left and right to create a margin of 30%) }
This does not mean all the text within the container will be exactly in the middle ( only the container including the text). If you add:
.container { width: 70%; margin: 0 auto; (meaning it distributes equal space left and right to create a margin of 30%) text-align: center ( every text will be centered within the centered container ) }
Hope it helps!