Centre using Auto Margins

/ Published in: CSS
Save to your folder(s)

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

Copy this code and paste it in your HTML
  1. body {
  2. margin:50px 0px; padding:0px;
  3. text-align:center;
  4. }
  6. #Content {
  7. width:500px;
  8. margin:0px auto;
  9. text-align:left;
  10. padding:15px;
  11. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.