Wikia

Html

Talk0
645pages on
this wiki

This article is about <html>, the root element of any HTML document. For other uses, see HTML (disambiguation).


Html
Basic usage:
<!DOCTYPE html>
<html>
    <head>
        ...
    </head>
    <body>
        ...
    </body>
</html>
Spec version 1.0
IE Version 1.0
Firefox 1.0
Google Chrome 1.0
Safari 1.0
Opera 1.0
Example output:
See the top of your browser window.


The <html> element contains the entire structure of any HTML document, and its first child must be a <head> element, followed by a <body> element. See the tutorial for an introduction to making HTML documents.

Contents

Example code Edit

<!DOCTYPE html>
<html>
 <head>
     <title>The title</title>
      [other head content]
  </head>
  <body>
      [body content]
  </body>
</html>

Attributes Edit

Rendering Edit

On most user agents, the <html> element has no visual appearance apart from being a container for the <body> element.

Typical CSS representation:

html {
    display: block;
}

Typical webmail clients remove the <html> element when displaying an HTML-formatted email.

Coding rules Edit

The <html> element is the root element of a document, or the root of a subdocument. It can only contain one <head> element followed by one <body> element.

Both the start and end tags are optional. The <html> element is automatically generated when the tags are not used.

HTML5 requires the start tag if the element's first child is a comment, and requires the end tag is the element is followed by a comment.[1] For example:

<!doctype html>
<html>
  <!-- the html start tag is required because of this comment -->
  ...
</html>
<!-- the html end tag is required because of this comment -->

References Edit

  1. http://dev.w3.org/html5/spec/Overview.html#optional-tags

External linksEdit