Div vertical center
Align the DIV center using margin-left: auto; margin-Right: auto; to align your Div center. . Style {margin-left: auto; margin-Right: auto;} stands for. style {margin: 0 auto;}. The number 0 indicates that the margin is 0. You can set different values as needed.<Style type = "text/CSS">. align-center {margin: 0 auto;/* center. Other attributes are not required */width: 500px; /* adding a width to the top of the browser does not show the center effect */Background: red;/* Background Color */* text and other content in the center text-align: center; * //} </style> @ HTML. partial ("_ partialmenuimg ",".. /.. /images/sys/test.jpg ") <Div class =" align-center "> </div>
Vertical and horizontal center of Div
1. For the center, use CSS: Position: fixed; left: 50%; top: 50%; margin-left: width/2; margin-top: height/2; for IE6, you can only change position: to absolute;<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns = "http://www.w3.org/1999/xhtml" lang = "ZH-CN"> Div vertical Vertical Horizontal Center