Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

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

  • Last Updated : 16 Jan, 2022

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 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.

Syntax:

<container_tag>
    // content
</container_tag> 

The below example illustrates the use of a container tag:

Example:

HTML




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

Output:

Container Tags

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!