1 Sept 2015

How to do Horizontal Centering

 Horizontal Centering

To horizontally center block level elements in CSS you need three things. You need to explicitly set a width on the element, set the left and right margins to auto, and include a proper doctype to keep older versions of IE from going into quirks mode.
div#page {width: 960px; margin: 0 auto}
The above will center the div with an id of page inside it’s parent container.
Share:

0 comments:

Post a Comment