Open In App
Related Articles

Which tag can be used as a container for the HTML elements ?

Improve Article
Save Article
Like Article

There are lots of tags that can be used as a container in HTML. These tags are generally divided into three parts, i.e., the opening tag, the content (which will display in the browser), and the closing tag. The content part can contain some other tags. The opening and closing tags are used in pairs. If you forget to close the container tag, the browser applies the effect of the opening tag until the end of the page. Therefore, one must be careful while working with container tags.

Some tags that can be used as a container are given below:

  • HTML <div> tag: The div tag is known as the Division tag. It is used to make divisions of content in the web page like text, images, header, footer, navigation bar, etc.
  • HTML <article> tag: The <article> tag is used to represent an article in the page. It is a new tag provided in HTML5.
  • HTML <section> tag: The <section> tag can be used to define sections such as chapters, headers, footers, etc of a document. It can also divide the content into subsections.
  • HTML <header> tag: The <header> tag is used to define the header for a document or a section as it contains the information related to the title and heading of the related content.
  • HTML <footer> tag: The <footer> tag is used to define a footer of a document. It section contains information such as the author’s information and copyright information.
  • HTML <form> tag: The <form> tag is used to create forms that allow taking input from the user. All the input elements can be enclosed within this tag.


    // content

The below example illustrates the use of a container tag:

Example: In this example, we will use <article> tag for the container.


<!DOCTYPE html>
<html lang="en">
            <h1 style="color:green">
                A Computer Science portal for geeks.
                It contains well written, well thought
                and well explained computer science and
                programming articles.


Container Tags

Last Updated : 01 Jun, 2023
Like Article
Save Article
Similar Reads
Related Tutorials