Margin: 0 auto; no center in IE8

Source: Internet
Author: User

IE8 is no longer useful to margin: 0 auto; this CSS does not seem to be useful, and the page cannot be centered. I will come back in the afternoon to see how to center it. The front-end of the Pacific also said that their company ignored the existence of IE8, test or previous version.
The reason is found. I wrote the margin: 0 auto; in the body tag. IE7 and lower can be centered, and IE8 won't work. The solution is Code Write it in the DIV frame.

Baidu search materials: program code <style type = "text/CSS">
Body {text-align: center; width: 100% ;}
# Wrap {
Text-align: left;
Width: 560px;
Margin: 0 auto;
Border: 1px solid #333;
Background-color: # CCC;
}
</Style>
<Div id = "Wrap"> effective methods in all browsers: <PRE> effective methods in all browsers: effective methods in all browsers:
</PRE>
</Div>

[This log was edited by Vincent at AM,]
ArticleFrom:Original Site
Reference announcement:View All references | I want to reference this article
Tags:Comment: 1 | reference: 0 | views: 467

reply fengyunshen [PM |] body
{< br> text-align: center;
}< BR ># wrap
{< br> margin: auto;
}< br>, you can try it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.