Open In App

Which tags contain both opening & closing tags in HTML ?

HTML tags help web browsers to convert HTML documents into web pages. Tags are always enclosed in angle brackets < >. Tags are case insensitive

So to better understand which tags are opening and closing in nature, we can divide them into 4 parts.

Document structure tags:

Example 1: The following example demonstrates the title as “Tag Example” in the browser title bar. The body tag renders all the data in the web browser.




<!DOCTYPE html>
<html>
  <head>
    <title>Tag Example</title>
  </head>
  <body>
    This is an example for GeeksforGeeks HTML tags.
  </body>
</html>

Output:

Semantic Tags: Semantic elements have meaningful names which tells about type of content.

Example 2: The following code demonstrates some of the semantic tags.




<!DOCTYPE html>
<html>
  <head>
    <title>Tag Example</title>
  </head>
  <body>
    <article>
      <header>A heading here</header>
      <main>
        <nav>
          <a href="/html/">HTML</a> | <a href="/css/">CSS</a> |
          <a href="/js/">JavaScript</a> |
          <a href="/python/">Python</a>
        </nav>
  
        <p>GeeksforGeeks GeeksforGeeks GeeksforGeeks GeeksforGeeks</p>
        <aside>
          <p>GeeksforGeeks</p>
  
          <p>GeeksforGeeks GeeksforGeeks GeeksforGeeks GeeksforGeeks</p>
        </aside>
        <p>GeeksforGeeks GeeksforGeeks GeeksforGeeks GeeksforGeeks</p>
      </main>
  
      <footer>Write footer here</footer>
    </article>
  </body>
</html>

Output:

Tables Tag: HTML Table is an arrangement of data in rows and columns, or possibly in a more complex structure.

Example 3: The following code demonstrates the table tags.




<!DOCTYPE html>
<html>
  <head>
    <style>
      table,
      th,
      td {
        border: 1px solid black;
        text-align: center;
      }
    </style>
  </head>
  <body>
    <h2>GeeksforGeeks Employee's Saving</h2>
    <table style="width: 20%">
      <tr>
        <th>Name</th>
        <th>saving</th>
      </tr>
      <tr>
        <td>Kishan</td>
        <td>$200</td>
      </tr>
      <tr>
        <td>Pradumna</td>
        <td>$150</td>
      </tr>
      <tr>
        <td>Riya</td>
        <td>$50</td>
      </tr>
      <tr>
        <td>Rohan</td>
        <td>$100</td>
      </tr>
      <tr>
        <td>Samaksh</td>
        <td>$170</td>
      </tr>
    </table>
  </body>
</html>

Output:

Container Tags: Container tags are generally divided into three parts, i.e., opening tag, content(which will display on the browser), and closing tag. In the content part, they can also contain some other tags. 

Article Tags :