Let a large div appear centered on the page:
The HTML code is as follows:
< Body > < ID= "container"></div></ Body>
Imperfect method:
1, only in the IE browser Center
<style type= "text/css" media= "screen" >
* {padding:0px;margin:0px; }
/**
* Centered in IE browser only
/Body{text-align:Center; }
#container{width:1100px;Height:500px;Border:1px solid #229; }</style>
2, outside the Internet Explorer, the other browser in the center
<style type= "text/css" media= "screen" > *{padding:0px;margin:0px; }#container{width:1100px;Height:500px;Border:1px solid #229;margin:Auto;/*in the browser outside of IE browser, to achieve the center*/}</style>
2. Center in all browsers
<style type= "text/css" media= "screen" > *{padding:0px;margin:0px; }#container{width:1100px;Height:500px;Border:1px solid #229;
/**
* The following three innings of code, to achieve the center of all browsers
/Position:Absolute; Left:50%;Margin-left:-550px; /* #container宽度的一半 */}</style>
About the center display of Div