HTML - Document


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.


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


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


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

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.




Documentation / Reference

Powered by ComboStrap