Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Paired and Single Tags | Tags and Attributes
Ultimate HTML
course content

Course Content

Ultimate HTML

Ultimate HTML

1. Web Development
2. Tags and Attributes
3. Document Structure
4. Media and Tables
5. Forms

bookPaired and Single Tags

In HTML, there are both paired tags and single tags (also known as self-closing tags or void elements). Each type serves a specific purpose and has its own function.

Paired Tags

Paired tags consist of opening and closing tags. They can wrap around the content and group items to change some properties or collect elements by meaning.

Syntax:

Here's a real example of using paired tags:

html

index

css

index

js

index

copy

Single tags

Single tags consist of only an opening tag and no closing tag. They are used when the tag does not require content or when all content and behavior are specified using attributes.

Syntax:

Here's a real example of using single tags:

html

index

css

index

js

index

copy

Tag nesting

When nesting tags, following the hierarchy order is essential, similar to nesting dolls. Each nested tag should be enclosed appropriately within its parent tag while still following the rules of HTML syntax.

Here's an example of nested tags:

Let’s consider the next valid (correct) example:

html

index

css

index

js

index

copy
  • <p> - defines a paragraph (parent element);
  • <a> - defines a hyperlink (child element);
  • <em> - marks text that has stress emphasis (child element).

Note

To summarize, HTML consists of paired and single tags, each serving different purposes. Paired tags have an opening and closing tag to enclose content, while single tags are self-closing. Properly nesting tags and following the correct hierarchy are essential for a well-formed HTML structure.

What are the two main categories of HTML tags? Please provide the names of these categories.

What are the two main categories of HTML tags? Please provide the names of these categories.

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 3
some-alt