HTML Html Element

Sunday, February 05, 2012

Within an HTML page, there is a very important element called "html". The <html> tag instructs the browser that this is an HTML document. The <html> element is also known as the root element. The <html> element is the container for all other HTML elements in the html document except for the <!DOCTYPE> declaration. All other html elements are contained within a start and an end <html> tag as shown in the following example:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>Computers R Us</title>
    <meta name="description" content="Get Computers, servers and laptops on Sale!!!" />
    <meta name="keywords" content="computers,servers,laptops" />
    <link href="styles/master.css" rel="stylesheet" type="text/css" />
    <style type="text/css">table {border:0px solid black;}</style>
    <script type="text/javascript">..content..</script>
  </head>
  <body>
    <h1>Main heading</h1>
  </body>
</html>

Required Attributes

If the DOCTYPE is set to XHTML, then the xmlns attribute is required. For HTML, it is invalid.  The required attribute is added as shown in this example:
<html "xmlns=http://www.w3.org/1999/xhtml">


AttributeValueDescriptionDTD
xmlnshttp://www.w3.org/1999/xhtmlSpecifies the namespace to use only for XHTML documents.STF

Optional Attributes


AttributeValueDescriptionDTD
dirrtl, ltrSpecifies the text direction for the content in an elementSTF
langlanguage_codeSpecifies a language code for the content in an elementSTF
xml:langlanguage_codeSpecifies a language code for the content in an element, in XHTML documentsSTF

Did you find the page informational and useful? Share it using one of your favorite social sites.

Recommended Books & Training Resources

HTML CSS: The Complete Reference Creating Web Pages Simplified HTML CSS and JavaScript Editor