Loading...

HTML Elements

You already know the basic document skeleton. This session zooms into the building blocks inside that page: HTML elements. Every heading, paragraph, and most other pieces of a page are elements.

What is an HTML element?

An HTML element is a complete unit of markup. For most elements that wrap content, it has three parts:

  1. A start (opening) tag — for example <p>
  2. The content — the text or nested elements inside
  3. An end (closing) tag — for example </p>
    Together, <p>Hello</p> is one paragraph element.

Direct answer

An HTML element usually means a start tag, optional content, and an end tag that match. The browser uses that pair to know where the element begins and ends. Some empty elements do not wrap content and therefore do not use a separate end tag.

Element with start tag, content, end tag

html
HTML Code
<p>This is a paragraph element.</p>
<h1>This is a heading element.</h1>

Reading the example

  • <p> opens a paragraph element
  • The text between the tags is the content
  • </p> closes the paragraph
  • The heading works the same way with <h1> and </h1>

Nested elements

Elements can sit inside other elements. That is called nesting. The inner element must be fully opened and closed before the outer element closes.

Nested elements

html
HTML Code
<p>This paragraph contains a <strong>important</strong> word.</p>

Here the strong element is nested inside the p element. Nesting lets you mark meaning inside larger chunks of content. Keep the tree clean: do not overlap tags like opening p, opening strong, then closing p before strong.

Empty (void) elements

Some elements do not wrap content. They are often called empty or void elements. A common beginner example is the line break:

Empty br element

html
HTML Code
<p>Line one.<br>Line two.</p>

The <br> tag creates a line break. It has no separate closing tag and no inner text. Later you will meet other empty elements such as images. For now, remember: not every element looks like a start-content-end sandwich.

Tags vs elements

People sometimes say “tag” and “element” as if they were identical. A tag is the markup in angle brackets. An element is the whole unit the browser understands — often start tag + content + end tag. Saying “the p element” usually means the complete paragraph unit.

Try it yourself

  1. Open your basic HTML file
  2. Add a paragraph with nested strong text
  3. Add a second paragraph that uses <br> between two short lines
  4. Save and refresh the browser
  5. Confirm bold text and the line break appear as expected

Common mistakes

  • Forgetting the closing tag for elements that need one
  • Overlapping tags instead of nesting them cleanly
  • Treating every tag as if it must have content and an end tag (empty elements differ)
  • Using the wrong closing name, such as </p> paired with <h1>
  • Putting visible page content outside body

Summary

  • Most HTML elements use a start tag, content, and an end tag
  • Nested elements must close in the correct order
  • Empty elements like br do not wrap content
  • A tag is the bracketed marker; an element is the full unit
  • Practice nesting and a simple line break in your page
  • Attributes, which add extra information to tags, come in the next session

🧠 Test Your Knowledge

Ready to Start

Test Your Knowledge

Challenge yourself with this interactive quiz and see how well you understand the topic

❓
8
Questions
🎯
70%
To Pass
♾️
∞
Time
🔄
∞
Attempts

📝 Instructions

  • Read each question carefully
  • Select the best answer for each question
  • You can retake the quiz as many times as you want
  • Your progress will be shown at the top