HTML - Document

About

An HTML document 1) is a well-formed HTML string (ie that contains the html root element).

As from one document with Javascript, you can show different text, a web page is a logical representation of a document

Storage

The HTML textual representation can be stored:

When the browser process this page, it will create an in-memory/code representation and the HTML page becomes a DOM document.

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.

HTML vs XML

Rendering

To display a page, a browser:

  • fetches the HTML document over the network (generally with a Http get request)
  • parses the HTML,
  • and then converts it into a code / in-memory representation called a DOM document: (Document Object Model: A tree of nodes)

This is described in details in this page: Web - Timeline of a page load (Page Speed|Page Latency)

Type

Id

The identifier of a HTML document is its URL.

But because you may render or move a HTML page to another URL, the rel=canonical was introduced to represent an universal id (as described in RFC 6596).

And to complicate things, all metadata schema may also have their own meta where to store this information. For instance, og:url for the open graph tag

Move

On Facebook, If you move a page to a new URL, you can use the old URL as the canonical source for the new URL, retaining likes, comments and shares for the object. Ref Ref2 - How do I move a page to a different URL?

Html document inside Html document

Note that a html document can contain other document with the frame, iframe.


Powered by ComboStrap