ie method: <body style= "Text-align:center;" >
The content within the <body> tag is centered.
Non ie method: <div style= "Margin-left:auto;margin-right:auto;" ></div>
<div> the left and right margins of the mark are automatically adapted to achieve the center effect.
The standard recommended CSS use method is the latter, IE's set of non-standard.
However, using the standard DTD declaration (XHTML version) in IE6, you can also use the margin:0 auto method to achieve the center effect.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > < HTML xmlns= "http://www.w3.org/1999/xhtml" > <pead> <style type= "Text/css" >. ie {text-align:center; widt h:100%; /* IE Center/* IE Div {width:200px border:solid 1px #999;} . PR {margin:0 auto; width:200px border:solid 1px #f00}/* Standard center/</style> <title> Center </title> < /head> <body> <div class= "ie" > <div>ie center </div> </div> <pr/> <div clas s= "PR" > Standard center </div> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]