Skip to content

Try our new Crash Courses!

Become a member using the button below to hide this banner and gain access to our new Crash Courses.

Self-closing tags – HTML

Summary

<!-- This element creates a line break -->
<br>

<!-- This element creates a horizontal line to divide content -->
<hr>

Details

Some HTML elements require opening and closing tags, while others are made up of a single self-closing tag, as you can see in the examples above.

A self-closing tag is made of an element’s symbol wrapped in angle brackets. It does not require a forward slash.

Elements that use self-closing tags are referred to as empty elements.

Some examples of empty elements are hr, br, and img.

Demo

Exercises

Recreate the code snippet in the Demo section by typing out the code in your index.html file.

References

HTML basics on MDN

Lesson tags: Open Lesson
Back to: HTML Reference > HTML Syntax