HTML Elements

HTML Elements

  • The HTML element is everything from the start tag to the end tag:
  • <tagname>content</tagname>
  • HTML elements can be nested (elements can contain elements).
  • Some HTML elements do not have an end tag.
  • HTML tags are not case sensitive: <P> means the same as <p>.


Example

<!DOCTYPE html>
<html>
<body>

<h1>My First Heading</h1>
<p>My first paragraph.</p>

</body>
</html>

Output:
My First Heading

My first paragraph.

Empty HTML Elements
  • HTML elements with no content are called empty elements.
  • <br> is an empty element without a closing tag (the <br> tag defines a line break).
  • Empty elements can be "closed" in the opening tag like this: <br />.