Course Content
Ultimate HTML
Ultimate HTML
Paired 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:
index
index
index
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:
index
index
index
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:
index
index
index
<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.
Thanks for your feedback!