×

What is a Container tag?

In HTML, there are different types of tags or say instructions which make the developer specify various elements in the document and make the browsers understand what to display.

Tags in HTML are mainly classified into two types, which are:

  1. Container tag
  2. Empty tag

Now, Let’s understand about the Container tag.

Container tags are basically defined as tags that consist of both opening and closing tags, and in between these two tags, a content is specified, which is to be visible in the browser. This content can either be of one or more lines and can consist of multiple HTML tags, whether it be a Container or an Empty tag. In HTML, Container tags are basically used to enclose text, videos, audio, images, etc. The majority of tags present in HTML are Container tags.

When a Container tag is opened and a piece of content is specified, one must close the Container tag, or else browsers tend to automatically mark its end till the end of the page and everything in between gets rendered according to the effect of the Container tag. By giving Container a Class or ID, the entire content inside the Container tag can easily be styled up using CSS (Cascading Style Sheets).

Syntax

'<container tag name>'Your Content'</container tag name>'

There are three major Container tags that contain all the other tags present in an HTML document.

  1. <html> tag: This is a root of the HTML document, which provides a container for each and every tag in the document.
  • <head> tag: This tag holds the metadata of the document that is, it consists of all the information of the document. This metadata can be the webpage's title, the document's character encodings, and the address of all the external resources, whether it be CSS stylesheets, JavaScript files, favicons, etc.
  • <body> tag: This is the body of the document where all the content to be displayed in the browser is specified, for example – headings, images, text, etc.

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta HTTP-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Three Major Container Tags</title>
</head>
<body>
<p>This is the tutorial on Container tags.</p>
</body>
</html>

Output

What is a Container tag

Under this body tag, the container tags are again further divided into the following types.

  1. Styled Container tags
  2. Block Container tags

Styled Container tags

These are HTML tags that come with predefined styles applied to them by the browser. These default styles are mentioned under a user-agent stylesheet of the browser, and these styles get automatically applied to them when they are in use.

When developers use these tags, they can either go with their default styling or can modify them according to their choice.

Following are the different types of Styled Container tags.

  • <button> tag - This tag is used to specify buttons on the webpage.
  • <h1> to <h6> tags – These tags are used to specify headings for the upcoming content on the webpage.
  • <p> tag – This paragraph tag is used to specify contents.
  • <a> tag – This is a Hyperlink tag used to specify links on the webpage.
  • <ol>,<ul>,<li> - These are list tags used to specify the Ordered and Unordered lists on the webpage.
  • <b>,<i>,<strong> - These are used to style up the text by making them bold or italic on the webpage.

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta HTTP-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Styled Container Tags</title>
</head>
<body>
<label>Button tag - </label>
<input type="button" value="Click Me">
<br>
<h1><span>Heading tag - </span> This entire line is a heading tag.</h1>
<p><span>Paragraph tag - </span> This entire line is inside a p tag.</p>
<span>Anchor tag - </span><a href="https://www.google.com/">Google</a>
<br><br>
<span>Ordered List</span>
<ol>
<li>HTML</li>
<li>CSS</li>
</ol>
<span><b>Bold tag</b></span>
</body>
</html>

Output

What is a Container tag

Block Container tags

These Container tags have a default display as 'Block', which specifies that they will take the entire viewport width. This HTML tag is very useful to separate contents into different sections and style up using CSS.

The HTML document has only one Block Container tag, which is the '<div>' tag.

  • <div> tag – This tag is used to specify containers for content such as images, text, etc. By targeting the Class or Id of the div, the entire content inside it can be styled using CSS.

Example

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Block Container Tag</title>
</head>
<body>
<div><p>This p tag is inside the div tag.</p></div>
</body>
</html>

Output

What is a Container tag

Following is the list of all the Container tags in an HTML:

  • <a>
  • <abbr>
  • <acronym>
  • <address>
  • <applet>
  • <article>
  • <aside>
  • <audio>
  • <b>
  • <bdi>
  • <bdo>
  • <big>
  • <blink>
  • <blockquote>
  • <body>
  • <button>
  • <canvas>
  • <caption>
  • <center>
  • <cite>
  • <code>
  • <colgroup>
  • <datalist>
  • <dd>
  • <del>
  • <details>
  • <dfn>
  • <dialog>
  • <dir>
  • <div>
  • <dl>
  • <dt>
  • <em>
  • <embed>
  • <fieldset>
  • <figcaption>
  • <figure>
  • <footer>
  • <font>
  • <form>
  • <frameset>
  • <h1> to <h6>
  • <head>
  • <header>
  • <html>
  • <i>
  • <iframe>
  • <ins>
  • <kbd>
  • <legend>
  • <li>
  • <main>
  • <map>
  • <mark>
  • <marquee>
  • <menu>
  • <menuitem>
  • <meter>
  • <nav>
  • <nobr>
  • <noframes>
  • <noscript>
  • <object>
  • <ol>
  • <optgroup>
  • <option>
  • <output>
  • <p>
  • <pre>
  • <progress>
  • <q>
  • <rp>
  • <rt>
  • <ruby>
  • <s>
  • <samp>
  • <script>
  • <section>
  • <select>
  • <small>
  • <span>
  • <strike>
  • <strong>
  • <style>
  • <sub>
  • <summary>
  • <sup>
  • <table>
  • <tbody>
  • <td>
  • <textarea>
  • <tfoot>
  • <th>
  • <thead>
  • <time>
  • <title>
  • <tr>
  • <tt>
  • <u>
  • <ul>
  • <var>
  • <video>
  • <xmp>

Related Topics

HTML Id Attribute

The HTML id attribute represents the unique identifier for an element of the HTML document. Each element has its unique identifier. The id attribute is a global attribute that can be...

12 minutes read.

HTML5 Attribute

HTML Attribute HTML attributes are special words that provide additional information about the HTML element or attributes.The element or tags have attributes, which define the element's behavior.It also adds attributes with a start...

3 minutes read.

HTML Charsets

In this tutorial, we are going to discuss about the charsets in the HTML. The letters, numbers, and several other symbols are shown correctly by the web browser. All of this...

2 minutes read.

HTML Form Action

The <form> tag has an attribute named action that contains a URL. The HTML action attribute defines the webpage URL on which you want to send the data after submitting...

4 minutes read.

HTML <table> tag

The Table element If we want to show the data and information in a two-dimensional table with rows and columns, then we can achieve this by using the HTML element <table>. Syntax: <body> <table> <thead> <tr> <thcolspan="#">………….</th> </tr> </thead> <tbody> <tr> <td>……….</td> <td>……….</td> </tr> </tbody> </table> </body> Example: <!DOCTYPE...

9 minutes read.

HTML5 Button Tag

HTML Button Tag The < button > tag is used on the webpage to construct a clickable button inside the HTML. Within the < button>....</button > tag, we can place content...

2 minutes read.

HTML City tag

HTML <City> tag HTML < cite > tag specifies a citation, a reference or title to a creative work, quoted content, books, websites, a research paper, a blog post, a painting,...

3 minutes read.

HTML Font Size

The HTML <font> tag uses the size attribute to specify the size of the text. We can set the size attribute’s value from 1 to 7. The default size of...

4 minutes read.

What is a Container tag?

In HTML, there are different types of tags or say instructions which make the developer specify various elements in the document and make the browsers understand what to display. Tags in...

5 minutes read.

HTML <summary> tag

When we simply want to show the primary heading or topic name of hidden detailed material to users, then we can achieved this by using the summary tag. This makes it...

2 minutes read.

How to change font in HTML

To give style to the content of your website, you may change the font of the text and make your website look attractive to the user. There are several methods which...

4 minutes read.

HTML Hide Element

The HTML hide element is used to hide the element. We place the hidden attribute inside those elements which we want to hide. The hidden attribute is a Boolean attribute. The...

3 minutes read.

How to add Google Translate Button on your Webpage?

Google translator is a multi-language translator used for translating the webpage. Google develops it. In today's digital age, it is essential because information is available worldwide in some specific language...

5 minutes read.

HTML <strong> tag

The strong element in HTML is used to display the real significant information in bold so that the user or reader will understand it easily. Syntax: <p> <strong>………… </strong> </p> Example Here, we will demonstrate how to...

2 minutes read.

HTML Paragraphs

In html, there are some elements which starts with new line and one of them is paragraph. Which is said to be a block of text. In html <p> tag...

4 minutes read.

How to insert image in HTML

An image (technically digital image) in HTML or even in general technical aspects is a binary representation of visual information. By visual information we mean, in the form of drawings/pictures,...

5 minutes read.

HTML Button Disabled

The HTML <button> element has many attributes, one of them is the disabled attribute. The button on which you apply the disabled attribute will not work, or we can say...

4 minutes read.

HTML <address> Tag

Hyper Text Markup Language, HTML is the best markup language for creating Web pages. HTML consists of a wide variety of elements. In all of these elements, one element is...

4 minutes read.

HTML <sub> tag

The sub element in HTML is used to describe one or more subscript texts. If The sub tag shows the text which is presented in a smaller font and below...

2 minutes read.

HTML Unordered List

In HTML, we have <ul> tag which defines the unordered list. And it is also known as bulleted list, because as we know it is not ordered list therefore it...

2 minutes read.