Youssef Sherif
last year
Youssefcountry asked

What does immediate child mean in HTML?

Abhay Jajodia
Expert
last year
Abhay Jajodia answered

Hi Youssef,

An immediate child is an element that is directly inside another element, with nothing in between.

Example:

<ul>
  <li>Item</li>
</ul>

<li> is the immediate child of <ul> because it is directly inside it.

If it was like this:

<ul>
  <div>
    <li>Item</li>
  </div>
</ul>

Then <li> is not an immediate child of <ul>. The <div> is.

If you have more questions, I am here to help 😊

HTML
This question was asked as part of the Learn HTML course.