HTMLHTML · Lesson 02

HTML Elements

Tags, content, nesting and empty elements.

Video tutorialTrack course · freeCodeCamp
Speed
Next lesson
Watch 00:00 · 1 checkpoints Watch on YouTube More on this topic
Transcript & captions
6/6

An element is written with a start tag, some content, and an end tag: <p>content</p>. Elements can be nested inside each other, but they must be closed in the reverse order they were opened.

htmlhtml
<div>
  <h2>Title</h2>
  <p>Some <strong>bold</strong> text.</p>
</div>

Some elements are empty — they have no content and no closing tag, like <br>, <hr>, <img> and <input>.

Try it yourself

Knowledge check

0/1 answered

Which of these is an empty element?