HTML Elements - HTML Tutorial - W3Teach
Home / HTML Tutorial / HTML Elements & Tags

HTML Elements

HTML Elements

An HTML element is defined by a start tag, some content, and an end tag.

<tagname> Content goes here... </tagname>

The HTML element is everything from the start tag to the end tag.

Nested HTML Elements

HTML elements can be nested (elements can contain other elements). All HTML documents consist of nested HTML elements.

The following example contains four HTML elements: <html>, <body>, <h1> and <p>.

Never Skip the End Tag

Some HTML elements will display correctly, even if you forget the end tag. However, never rely on this! Unexpected results and errors may occur if you forget the end tag!

Empty HTML Elements

HTML elements with no content are called empty elements. The <br> tag defines a line break, and is an empty element without a closing tag.

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>
<br>
<hr>
<p>This has a line break<br>inside the paragraph.</p>

</body>
</html>
Result
Test Your Knowledge!

Take our HTML Tutorial quiz and earn a certificate.