/ 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.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
#inner {
width: 50%; /* This is a example number */
margin: auto;
}
URL: http://stackoverflow.com/questions/114543/how-to-center-div-in-div
Comments
 Subscribe to comments
                    Subscribe to comments
                
                