HTML - Document

About

An HTML document is the in-memory (in-code) representation of an HTML file that permits to manipulate it.

It's more precisely:

It represents the root HTML element as a DOM tree with all sub html elements represented as DOM elements.

Every XML and HTML document in an HTML UA (browser) is represented by a Document object.

Address

The URL associated with a Document is the document's address.

Semantics

Elements represent things; that is, they have intrinsic meaning, also known as semantics. For example, an img element represents an image.

Structure

<!-- tells the browser what language it's reading -->
<!DOCTYPE html>
<!-- Starts the HTML document -->
<html>
 <head>
  <title>Sample page</title>
 </head>
 <body>
  <h1>Sample page</h1>
  <p>This is a <a href="demo.html">simple</a> sample.</p>
  <!-- this is a comment -->
 </body>
<!-- Ends the HTML document -->
</html>

There are always two parts to the file:

  • the head: The head includes metadata information about the web page, such as its title.
  • and the body. The content in the body is what will be visible on the actual page.

Tags:

HTML vs XML

Documentation / Reference


Powered by ComboStrap