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