Pls explain Nesting in HTML | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Pls explain Nesting in HTML

30th Jun 2020, 8:41 AM
Daniel Fomsi
Daniel Fomsi - avatar
2 Answers
+ 10
Nesting refers to an element residing within a parent element… Example, <!DOCTYPE html> <html> <head> <title>Title</title> </head> <body> <h1>Heading</h1> <p>Paragraph text, with some <em>bold</em> text for effect</p> </body> </html> In the above example all elements are nested within the <html> element, the <title> element is nested withing the <head> element, and both the <h1> element and the <p> element are nested within the <body> element. The <em> element is nested within the <p> element, which in turn is part of the <body> element. This is usually presented by the use of spacing for readability, however, this is not essential to the file, in fact it could be a single line and it would still generate the same output. I hope this helps. Happy Coding !!
30th Jun 2020, 9:17 AM
BRight
BRight - avatar
+ 3
HTML tags should be “nested” in a proper order that the tag opened most recently is always the next tag to close check this article it is really helpful http://www.bu.edu/tech/services/cccs/websites/www/non-wordpress/start/html-introduction/syntax/nesting-tags/#:~:text=HTML%20tags%20should%20be%20%E2%80%9Cnested,sample%20contains%20two%20nesting%20errors.
30th Jun 2020, 9:17 AM
Meriam Selim
Meriam Selim - avatar