#outer { width: 100%; } #inner { width: 50%; margin: 0px auto; }Of course, you don't have to set the width to 50%. Any width less than the containing div will work. The margin: 0px auto is what does the actual centering. It can be done in a different way as well.
#outer { width: 100%; text-align: center; } #inner { display: inline-block; }That makes the inner div into an inline element that can be centered with text-align.
No comments:
Post a Comment