正逢公司网站改版上线,由于经验的不足没有考虑到兼容之前浏览器的版本。
现在遇到如下问题:
http://example.liambaba.com/liambaba-laboratory/temp-dir/users_login_0...
http://example.liambaba.com/liambaba-laboratory/temp-dir/users_login_0...
大家可以看这两个页面的不同,是因为申明头部造成的。
我希望能详细的了解为什么,如果在这里你能慷慨的给出意见,对我来说是莫大的帮助~!
The
If you want to know the details, you can check the code below:<!DOCTYPE>
reputation of the two main pages leads to different rendering modes. This results in a different user agent stylesheet loaded by the browser.Taking Chrome as an example, the declaration of
users_login_01.html
is<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
, which will trigger Chrome to render in Standard mode. The corresponding<input>
tag isbox-sizeing
. Andcontent-box
mistakenly declares non-standardusers_login_02.html
. Chrome will use Quirks mode for rendering, and the corresponding<!DOCTYPE>
isbox-sizeing
.border-box
User agent style sheet in Webkit standards mode: http://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css-
Webkit user agent stylesheet in mixed mode: http://trac.webkit.org/browser/trunk/Source/WebCore/css/quirks.css
-
Actually, the difference between the two pages is hereThe second solution of the poster was written incorrectly and should be <!DOCTYPE HTML> instead of <!DOCTYPE>. I checked the information and did not see such an abbreviation, so it was caused by the wrong writing of dtd. Mixed mode, resulting in box model errors.