Skip to content
Home Tutorials Roadmaps Courses
Log in Join free
Tutorials HTML HTML Elements
HTML Beginner FREE

HTML Elements

Lesson 1 of 16 Beginner Interactive

An HTML element is everything from the start tag to the end tag. Elements tell the browser how to display content.

Structure of an Element

An element consists of: Opening tag + Content + Closing tag

Self-Closing Tags

Some elements don't have closing tags. These are called void elements or self-closing tags. Examples: <br>, <hr>, <img>.

Syntax

HTML
<tagname>Content goes here</tagname>

<!-- Self-closing tag -->
<tagname />
Block vs Inline Elements
HTML
<!DOCTYPE html>
<html>
<body>
    <div style="background: #e0e0e0; padding: 10px; margin: 10px 0;">
        This is a DIV (block element)
    </div>
    <p>
        Paragraph with <span style="color: red;">a red span</span>
        and <strong>bold text</strong>.
    </p>
</body>
</html>

Practice

1
Exercise

Create an element that displays bold text.

Answer
<strong>Bold text</strong> or <b>Bold text</b>

Quick Quiz

1

Which tag creates a paragraph?

The <p> tag defines a paragraph.

Interview Questions

A void element is an element that cannot have child nodes. It has no content and no closing tag. Examples include <br>, <hr>, <img>, <input>, and <meta>.