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.
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>.
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!
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>
Take our HTML Tutorial quiz and earn a certificate.