HTML Elements

What are HTML Elements?

Consider this example,
<h1>Your heading</h1>
<p>Your paragraph</p>
In the above example, <h1>Your heading</h1> and <p>Your paragraph</p> are called HTML elements.
The opening tag, closing tag and the content between these tags together form an HTML element.

Empty Elements

Some HTML elements do not have a closing tag and are called empty elements. Empty elements are colsed in the opening tag itself.
Examples: <br />, <hr />

What is the syntax to wrtie HTML Elements?

Every HTML Element should have both an opening tag and a closing tag and the content must be included between these two tags
Correct syntax:
<p>Your page content in a paragraph.</p>
Incorrect syntax:
<p>Your page content in a paragraph.
For writing an HTML Element inside another HTML Element (nested HTML elements), the outermost opening and closing tags should belong to the same HTML element.
Correct syntax:
<body>
<p>
Your page content in a paragraph.
</p>
</body>
Incorrect syntax:
<body>
<p>
Your page content in a paragraph.
</body>
</p>