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
James Bryer
656 PointsHow to get your header in the centre of the page?
Its just not working! this is the code i have been using:
padding-top:10px; padding-bottom:10px; padding-left:1px; padding-right:1px;
margin-right: 5px;
margin-left: 5px;
margin-top:5px;
margin-bottom:5px;
border-radius: 25px;
text-align: centre;
It goes to slightly to the right and not the centre?
6 Answers
Peter Mumford
7,774 PointsAre you british by any chance? text-align: center;
Corissa Bragg
3,268 PointsI'm not sure if this is correct or not, can you just do margin: auto; ?
Miriam Tocino
14,201 PointsHi James!
In order to center any element horizontally margin left and right should be equal to auto. Taking your notes as an example, it looks like you want a margin top and bottom to be equal to 5px. Try this:
'''css margin: 5px auto; '''
The value of padding shouldn't change this behaviour, so you can freely play with it. Let me know if it works.
Good luck! Miriam
Miriam Tocino
14,201 PointsHi James!
In order to center any element horizontally margin left and right should be equal to auto. Taking your notes as an example, it looks like you want a margin top and bottom to be equal to 5px. Try this:
'''css margin: 5px auto; '''
The value of padding shouldn't change this behaviour, so you can freely play with it. Let me know if it works.
Good luck! Miriam
lee mullen
8,281 Pointsmargin: 5px 5px;
border-radius: 25px;
text-align: center;
This is what would be better to use as the margin 5px 5px would mean top bottom left and right and as for the text align i had this trouble its the spelling trying center over centre.
James Bryer
656 PointsThanks everyone!