Posted By

alozuldo on 10/25/10


div width auto margin center inside

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


Center a div inside of a div

 / Published in: CSS


Of course, you don't have to set the width to 50%. Any width less than the containing div will work. The margin: auto is what does the actual centering.

  1. #inner {
  2. width: 50%; /* This is a example number */
  3. margin: auto;
  4. }

Report this snippet  

You need to login to post a comment.