The margin attribute of jsp in ie6 is invalid.

Source: Internet
Author: User

Today, I wrote a logon page where I used the css of margin: 0 auto to center the div with the username and password. The result is normal in chrome and firefox, And the margin attribute in ie6 is invalid. After viewing the page and css, you cannot find any problem (the page is relatively simple ). Create an html file and copy the code in the body. The code displayed in ie is normal. It seems that it is not a problem with css. After comparison, we found that the difference is in DOCTYPE.

Modify doctype in jsp:

[Html]
<! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
To:

[Html]
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
I don't know why I need to add the xhtml dtd to reference ie6 for normal display. Ie6 is really troublesome. Record it. You can review it later.

 


From Xin Jing Xin

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.