Computers & ProgrammingHTML/XHTMLWeb Development

HTML Html Element

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" "">
    <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;
    <script type="text/javascript">
    <h1>Main heading</h1>

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=">

xmlns the namespace to use only for XHTML documents.STF

Optional Attributes

dirrtl, ltrSpecifies the text direction for the content in an element.STF
langlanguage_codeSpecifies a language code for the content in an element.STF
xml:langlanguage_codeSpecifies a language code for the content in an element, in XHTML documents.STF

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top