Today wrote a Div, with margin:0 Auto, to define his attributes, let him center, the result is invalid.
At first I thought it was CSS code conflict, check several times, no problem, and then use Firefox and Google Browser test, center ...
Seems to be a browser compatibility problem, suddenly remembered now with the Win7,ie has been upgraded to the IE8, it seems that the problem is IE8 compatibility. Baidu's ....
The workaround is copied to the following:
Ie6,7,firefox under the general use: Margin:auto to achieve, but under the IE8, it is not enough. Two solutions are now available:
Method One (recommended):
First, the document type must be set at the top of the page:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transition al.dtd ">
and add in head:
<meta http-equiv= "x-ua-compatible" content= "Ie=emulateie7"/> Can!
Method Two:
Body setting {text-align:center;width:100%;}
Include all div in <div id= "wrap" >, wrap is set as follows:
#wrap {text-align:left; width:***; margin:0 Auto;}
and add in head:
<meta http-equiv= "x-ua-compatible" content= "Ie=emulateie7"/>
Can!
Method Three:
Replace the wrap layer in two with <center></center>.
IE8 below margin:0 Auto; solution not centered, IE8 compatibility code