HTML

HTML – Nesting Structure

Nesting tags in HTML is widely used while playing with HTML code. This is the most important thing while doing HTML coding.

HTML tags should be arranged properly and closed properly. If the HTML tags are not arranged or closed properly, then there may occur problems.

What is the Nesting of HTML Tag? Simply the nesting of the tag using HTML tag, inside tag is known as the nesting of tags.

Similarly: As we know in programming loop inside loop is known as nesting of loop.

 Example:

<p><center><b>Cricket and</b><i>football are awesome games</i></center></p>

Output:
Cricket and football are awesome games

See the above example of the nesting of the html tags.

  1. <p> tag started.
  2. <center> tag started.
  3. <b> tag started and immediately it is closed </b> because it’s work is finish.
  4. <i> tag started and it is also closed before </center> tag because the <i> tag is started after <center> tag.
  5. </center> tag closed because it is started after <p> tag.
  6. Now finally </p> tag closed.

Note: You must have to close your tags sequentially one after another.  .

  1. <html> is the document so it started first and closed last </html>
  2. <head> is the decoration section, it contains title, meta tag for website so it started after <html> tag and close before<body> tag. or closed after defining the decorations sections, titles and meta tag.
  3. <title> comes inside the <head> tag and it starts and immediately it closed </title>.
  4. <body> it contains content of the websites so it comes after <html> and <head> tags and ends before </html> tag.
Back to top button