Open In App

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

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:



Syntax:

<container_tag>
    // content
</container_tag> 

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">
 
<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:

Article Tags :