In the previous chapters of our HTML course, we learned extensively about HTML elements and, in most cases, nested some inside others. All webpage elements are related in one way or another, with clearly defined relationships.
When we learned about header and footer tags in our HTML Body Fundamentals chapter, we created both elements and placed others inside them. For example, the header tag had <div>, <ul>, and <li> elements resting inside it, with the <li> tags sitting inside the <ul> tag.
Their presentation shows some relationship, and that's part of what forms the HTML document tree.
6 Responses
Thank you for explaining this so clearly! I think this the the first time I feel I truly understand the html tree's terminology.
Hi Maxime! SO HELPFUL! I tried running a couple of sites through the W3C validation test, and OH BOY! I have some work. I noticed many, many training slash errors. Does Elementor add those automatically, because I don’t think I’m doing that. Cheers! Sandy
Hey Sandy!
Yea the W3C validation is strict... don't put too much weight on it. And be careful with what it classes as "warnings" and as "errors". Errors really should be fixed. Warnings can sometimes be ignored without problems.
Which is which? What is <section> in the example given the below statements in this tutorial? Is it an "ancestor", a "parent", or "both"?
1. "The <section> element is an ancestor to the <h1>, <p>, <ul> and <li> elements."
2. "A parent is any element that's directly above another in the family structure."
Hey Romel!
In that example, the <section> element is an ancestor to the <h1>, <p>, <ul> and <li> elements.
However, it is a parent element only to the <section> element is an ancestor to the <h1>, <p>, <ul> elements.
Because the <li> elements are not direct children, the <section> is not a parent element of them.
I hope this clarifies it!
Cheers!
Correct me if my understanding of your reply is wrong - <section> is both a parent and ancestor to <h1>, <p>, and <ul> but only an ancestor to <li> while <ul> is a parent to <li>. Did I get that right?