How Can We Help?
< All Topics

Elements and Tags

A Website page is made up of multiple HTML elements and an HTML element is made of HTML tags.

HTML Tags

HTML tags are like labels or keywords to define a web page. These tags tell the browser about the format or structure of the content.

Most of the tags come in pair. One is called the opening tag and the other is the closing tag. Tags begin with a less-than sign “<" and end with a greater-than sign ">“. For example: <p></p> tags create paragraph content. While <h1></h1> tags are used to create headings.

HTML Element

An element in HTML generally consists of an opening tag, content, and a closing tag. We can see the HTML element as an individual web page component.

Start/Opening Tag

HTML elements start with opening tags. For example: <p><b><h1> etc.

End/Closing Tag

HTML elements end with closing tags. For example: </p></b></h1> etc.

Content

We place content between the opening and closing tags. For example: <p>This is sample content.</p>

Nested HTML Elements

HTML elements can be nested. This means that the HTML element can contain many other elements inside.

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>
<p>My sample paragraph content.</p>

</body>
</html>

HTML Empty Elements

HTML elements with no content are called empty elements. There are many empty elements that do not have a closing tag.

For example: <br> is an empty element without a closing tag. It is used to create line breaks.

It is good to close every tag. Empty elements can be “closed” in the same Opening tag. For example: <br />

HTML5 does not require empty elements to be closed. But if you want strict validation, or if you need to make your document readable by XML parser, you must close all HTML elements properly.

HTML5 does not require empty elements to be closed. But if you want strict validation, or if you need to make your document readable by XML parser, you must close all HTML elements properly.

Tips while using HTML Tags:

  • Always close HTML tags to validate your webpage against W3C Validation Standard.
  • HTML5 standard does not require lowercase tags but W3C recommends to use lowercase in HTML
Table of Contents