Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
Thread: Centering a footer
11-06-2012, 07:35 PM #2
- Join Date
- Dec 2006
- Thanked 1,827 Times in 1,811 Posts
To center an element you need three things:
- a valid DocType
- an element with a width
- that elements right/left margins set to auto
You have some other issues to consider first though.
- Your footer, #colophon, is 100% wide so it cannot be centered.
- Inside #colophon, you have #supplementary which is 100% wide PLUS 250px (your 125px left/right padding).
- In #supplementary, you have #'s first, second and third which you probably want to look like 3 columns.
Your best bet would be to figure out how wide #supplementary is and center that element.
For more information on how the padding in that element is breaking your layout, see the box model here. The box model says that whatever you put inside an element cannot be larger than that element. margin/padding/border all count when figuring width/height.
11-07-2012, 12:09 PM #3
- Join Date
- Sep 2006
- Thanked 0 Times in 0 Posts
Thanks. I didn't write the code - just trying to work with it. Thanks for the direction. Got it working.
Last edited by MTWK; 11-07-2012 at 12:26 PM.