What's the difference between "//W3C//DTD HTML 4.01" and "//W3C//DTD XHTML 1.0"? -
Hi all:
I want to get my actual height Browser, but I have some confusion about W3C DTD HTML 4.01 and // W3C / / DTC XHTML 1.0 , Below is an extension of my problem:
If I am using W3C DTD HTML 4.01 at the top of the page header and click document.body.clientHeight , then I can not get the full height of the browser:
& lt ;! DOCTYPE HTML PUBLIC "- // W3C // DTD XHTML 1.0 Transitional // N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> & lt; Html> & lt; Head> & lt; Meta http-equiv = "X-UA-Compatible" content = "IE = edge" /> & lt; Meta http-equiv = "content type" content = "text / html; charset = UTF-8" /> & lt; Title> test jquery height & lt; / Title> & lt; Script type = "text / javascript" src = "../ lib / jquery-1.8.3.min.js"> & lt; / Script> & lt; Script type = "text / javascript"> $ (function () {var height = document.body.clientHeight; warning (height);}) & lt; / Script> & lt; / Head> & lt; Body> & lt; Div style = "margin-left: 30px;"> & lt; Button> Start & nbsp; Select & lt; / Button> & lt; Button> Close & nbsp; Select7lt; / Button> & lt; / Div> & lt; / Body> & lt; / Html>
but if I change // to W3C // DTD HTML 4.01 or document.documentElement. ClientHyight , then I can get the actual height of the browser:
1. // Using W3C // DTD HTML 4.01
& lt ;! DOCTYPE HTML PUBLIC "- // W3C / / DTT HTML 4.01 Transitional // N"> & lt; Html> meta-http-equiv = "content type" content = "text / html; charset = UTF-8" /> & lt; Title> Test jQuery Height & lt; / Title> & lt; Script type = "text / javascript" src = "../ lib / jquery-1.8.3.min.js"> & lt; / Script> & lt; Script type = "text / javascript"> $ (function () {var height = de ocument.body.clientHeight; warning (height);}) & lt; / Script> & lt; / Head> & lt; Body> & lt; Div style = "margin-left: 30px;"> & lt; Button> Start & nbsp; Select & lt; / Button> & lt; Button> Close & nbsp; Select7lt; / Button <> >& lt ;! DOCTYPE HTML Public "- // W3C // DTD XHTML 1.0 Transcription // N" "http://www.w3.org/TR/xhtml1/DTD/Meta http-equiv =" X-UA-Compatible "Content =" IE = side "/> Meta http-equiv =" content-type "," XHTML-1-transcription. Dtd "" & lt; Head> & lt; Content = "text / html; charset = UTF-8" and title> test> jQuery height & lt; / Title> & lt; Script type = "text / javascript" src = "../ lib / jquery-1.8.3. Min.js"> & lt; / Script> & lt; Script type = "text / javascript"> $ (function () {var height = document.documentElement.clientHyight; warning (height);}) & lt; / Script> & lt; / Head> & lt; Body & lt; Div style = "margin-left: 30px;"> & lt; Button> Start & nbsp; & Lt; / Button & lt; Button> Close & nbsp; Select7lt; / Button> & lt; / Div> & lt; / Body> & lt; / Html>
So, what is the difference between my question "// W3C / DTD HTML 4.01" and "// W3C // DTD" XHTML 1.0 "?
Any help would be grateful!
What you have actually seen is the difference between the two document type declarations
& lt ;! DOCTYPE html public "- // W3C // DTD XHTML 1.0 Transcription // N Http: // Www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
and
First puts the browser in" Standard mode ", while later they are called" quirks mode " Weird things may happen and may include nonstandard calculations of widths and heights.
Unless it is about a heritage page that depends on the quirks mode, you will see "standard mode" Should use and specifications Ra CSS should use DOM.
Comments
Post a Comment