Return to Snippet

Revision: 34559
at October 25, 2010 09:22 by alozuldo


Initial Code
#inner {
    width: 50%; /* This is a example number */
    margin: auto;
}

Initial URL
http://stackoverflow.com/questions/114543/how-to-center-div-in-div

Initial Description
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.

Initial Title
Center a div inside of a div

Initial Tags
center

Initial Language
CSS