HTML Elements

An HTML element is one of the many defining parts of an HTML document. It is everything from the opening tag, the content of the tag and the closing tag. There are several HTML elements in an HTML document and each contribute to the total look of our final HTML document when we open it in a web browser.

Below is a table with examples of HTML elements.

Open tag Content Close tag
<p> This is a paragraph </p>
<table> * </table>
<a href=”link.html”> This is a link </a>
<hr /> ** **

* Contains nested HTML elements
** Doesn’t have any content or closing tag


HTML Element Syntax

From the table above we can see that the HTML element consists of all from the opening tag, the content of the tag and the closing tag. Now there are some elements like <hr /> which don’t have any content or closing tag; they are single tag elements. Another example of single tag elements is <br />. Also some elements have other elements inside of them. In the case of the table tag, we have other elements inside the tag, and that takes us to nested elements which we will get to next.

  • An HTML element consists of tags
  • An HTML element starts with the open or start tag
  • An HTML element ends with the close or end tag
  • The content of the element is whatever is between the open tag and the close tag
  • Some HTML elements do not have any content
  • HTML elements without contents are single tag elements which are closed in the open tag
  • Some HTML elements have other HTML elements nested inside them

Important HTML Elements

Although there are several HTML elements, there are some very important ones that need to be present in an HTML document for us to have a complete and fully supported HTML document. The important HTML elements are the <html> element, the <head> element, and the <body> element. There are several other elements which go into these elements.

<html>
<head>
<title> This is the title </title>
</head>
<body>
<p>This is the body</p>
</body>
</html>

HTML <html> Element

  • The HTML <html> element is the most important element of an HTML document
  • The HTML <html> element starts with <html> tag
  • The HTML <html> element consists of everything inside the HTML document
  • The HTML <html> element ends with </html> tag

HTML <head> Element

  • The HTML <head> element starts with <head> tag
  • The HTML <head> element consists of things related to description of the HTML document
  • The HTML <head> element ends with </head> tag

HTML <body> Element

  • The HTML <body> element starts with <body> tag
  • The HTML <body> element consists of things related to the content of the HTML document
  • The HTML <body> element ends with </body> tag