Structure of HTML page

Every webpage you create should has a structure to make your webpage more efficient and clear. Firstly you have to know structure of HTML tags and then structure of the whole HTML page.

Structure of HTML tags

Tags in HTML can be:

  • Paired Tags - That it they have both opening (<>) and closing </ >) tags and some content between them. For example tag paragraph (p) is paired tag: <p>Any text...</p>
  • Singular Tags - These tags don't need to be closed by closing tags. For example as tag for new line (br): <br />

Structure of HTML document

Any HTML page consist of two main parts:

  • HEAD - contains main informations about HTML page as title of webpage, icon and many others
  • BODY - contains everything what is visible on the webpage

HTML Structure

As we can see in the image above every HTML document should start with <!DOCTYPE> tag. It tells the browser what document to expect. More about this tag in the next chapter.

<html> tag represents the root of an HTML document and is must be written after <!DOCTYPE> tag.

<head> tag provides general information (metadata) about the document, including its title and links to its scripts and style sheets.

<body> tag represents the content of an HTML document. There can be only one <body> element in a document.

Example code of HTML Structure

<!DOCTYPE html>
      <title>Title of my website</title>

      <p>Visible content of my website</p>

By: Tomas Silny
Edited: 2020-11-02 22:47:23