HTML – Structure of Nesting of HTML Tags

0
4
digitalample eye
Nesting of tag in HTML is widely used while playing with the HTML code. This is the most important while doing HTML coding. HTML tag should arrange properly and closed properly. If the HTML tags are not arranged or closed properly then there may occur problems. What is Nesting of HTML Tag? Simply the nesting of the tag is 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 the awesome games</i></center></p>

Output:


Cricket and football are the 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. 
If you don’t understand above syntax see below image and try to understand.
Nesting of HTML Tags.
Nesting of HTML Tags.
In the figure lines has draws to make you better understand. 
  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.

LEAVE A REPLY

Please enter your comment!
Please enter your name here