How to Work with Empty and Container Tags in HTML
See HTML: Tips and Tricks for similar articles.Generally speaking, HTML has two types of tags: empty and container. In this how-to, you'll learn the difference between the two.
Most HTML elements consist of a starting tag, an ending tag, and everything that comes between the two tags, which is known as the element's contents. Here's an example of an element with a starting tag, and ending tag, and content:
<p>Hello, world!</p>
When tags are part of an element that can have content, the tags are called container tags.
Some elements only have a single tag and therefore can't have any content. These elements are called empty elements or empty tags.
Empty elements have the following syntax:
<tagname>
or
<tagname att1="value" att2="value">
The empty elements are:
<area>
<base>
<br>
<col>
<embed>
<hr>
<img>
<input>
<link>
<meta>
<param>
<source>
<track>
<wbr>
Related Articles
- HTML Heading Levels and Sectioning Content
- How to Ask Good Technical Questions
- How to Properly Nest Lists in HTML
- How to Install and Use Visual Studio Code for Class
- How to Open HTML Files in Your Browser from Visual Studio Code
- How to Create a Simple HTML Document
- How to Work with Empty and Container Tags in HTML (this article)
- How to Mark Up a Citation in HTML
- How to Create an HTML Table
- How to Force a Refresh of favicon.ico