The application of text-align: center shows different effects in different browsers, this article shows different displays in IE7, IE8 and IE9, and solves the problem of left-deviation displayed in IE8.
In IE7 and some browsers interpreted as elements and text within the element are centered.
In IE8 and IE9, some browsers interpret that the text within the element is centered.
E.g:
<div style = "border: 1px solid red; height: 150px; width: 150px; text-align: center;">
<div style = "border: 1px solid green; height: 100px; width: 100px;"> </ div>
Hello there
</ div>
Can be found in IE7, the elements use the text-align: center; After the div and the text are centered,
In IE8, the text within the element is centered, but the div element is not centered.
There are two solutions to this type of imbalance.
1 is ie7 tend to ie8, that is, ie7 also showed the effect of IE8, the element left home. The method is to add float: left on the element inside it
2 is so ie8 trend ie7 that is, ie8 also shows the effect of ie7, the element is centered. The method is to add margin: 0 auto inside the element; it's fine.