Posted By

1man on 07/05/06


Tagged

css auto centre margin


Versions (?)

Who likes this?

10 people have marked this snippet as a favorite

luman
meth
arturo
panatlantica
fatihturan
jacksont123
icarus
vali29
Carolyne
atulkransingh


Centre using Auto Margins


 / Published in: CSS
 

Taken from bluerobot. Create a content div, set the width and the margin set to auto will align the div to the centre horizontally.

  1. body {
  2. margin:50px 0px; padding:0px;
  3. text-align:center;
  4. }
  5.  
  6. #Content {
  7. width:500px;
  8. margin:0px auto;
  9. text-align:left;
  10. padding:15px;
  11. }

Report this snippet  

You need to login to post a comment.