What is the difference between "// W3C // DTD HTML 4.01" and "// W3C // DTD XHTML 1.0"?

Hello everybody:

I want to get the maximum height of the web browser, but I got some confusion in W3C DTD HTML 4.01 and // W3C // DTC XHTML 1.0 , below is my detailed information:

If I use W3C DTD HTML 4.01 at the top of the page title and use document.body.clientHeight , then I cannot get the full height of the browser:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test jQuery Height</title>

       <script type="text/javascript" src="../lib/jquery-1.8.3.min.js"></script>

       <script type="text/javascript">
         $(function(){
            var height=document.body.clientHeight;
        alert(height);
     })
   </script>
</head>
<body>
  <div style="margin-left:30px;">
       <button>Start Select</button>
       <button>Stop Select7lt;/button>
  </div>
 </body>
</html>

But if I go to // W3C // DTD HTML 4.01 or use document.documentElement.clientHeight , then I can get the actual height of the browser: <br / "> 1. Using // W3C // DTD HTML 4.01

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Test jQuery Height</title>

           <script type="text/javascript" src="../lib/jquery-1.8.3.min.js"></script>

           <script type="text/javascript">
             $(function(){
                var height=document.body.clientHeight;
            alert(height);
         })
       </script>
    </head>
    <body>
      <div style="margin-left:30px;">
           <button>Start Select</button>
           <button>Stop Select7lt;/button>
      </div>
     </body>
    </html>
  1. document.documentElement.clientHeight
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Test jQuery Height</title>

       <script type="text/javascript" src="../lib/jquery-1.8.3.min.js"> 
       </script>

       <script type="text/javascript">
         $(function(){
            var height=document.documentElement.clientHeight;
            alert(height);
         })
       </script>
    </head>
    <body>
      <div style="margin-left:30px;">
           <button>Start Select</button>
           <button>Stop Select7lt;/button>
      </div>
     </body>
</html>

, "//W3C//DTD HTML 4.01" "//W3C//DTD XHTML 1.0"?
!

+3
3

"//W3C//DTD HTML 4.01" "//W3C//DTD XHTML 1.0" , "HTML 4.01" "XHTML 1.0" .

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

" ", "quirks". quirks . .

, quirks, " " CSS DOM .

+2

HTML 4.01, .. "-//W3C//DTD HTML 4.01//", HTML 4.01, (, ) . HTML-, , (, , = "" )

HTML 4.01 i.e "-//W3C//DTD HTML 4.01 Transitional//EN" HTML 4.01. ( ), . , HTML-

XHTML 1.0 HTML 4.01, "-//W3C//DTD XHTML 1.0 Transitional//EN" "-//W3C//DTD XHTML 1.0 Strict//EN", , , , HTML-: XML.

+2

: http://www.w3.org/TR/xhtml1/diffs.html

: XHTML XML, XML-. HTML4 Transitional , , .

EDIT:

  • document.documentElement, , IE
  • document.body in IE quirks mode and in all other browsers that I usually use.

document.body is more standard than the other. But this does not apply to the (X) HTML standard.

+1
source

All Articles