Howe can we know whether head element is child of html element

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

<!DOCTYPE html>
<html>
<title>The best page ever</title>

<h1>The best page ever</h1>
<p>Cat ipsum dolor sit amet, jump launch to pounce upon little yarn mouse, bare fangs at toy run hide in litter box until treats are fed. Go into a room to decide you didn't want to be in there anyway. I like big cats and i can not lie kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff. Meow i could pee on this if i had the energy for slap owner's face at 5am until human fills food dish yet scamper. Knock dish off table head butt cant eat out of my own dish scratch the furniture. Make meme, make cute face. Sleep in the bathroom sink chase laser but pee in the shoe. Paw at your fat belly licks your face and eat grass, throw it back up kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

</html>
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3235.0 Safari/537.36

Challenge: Define the Head and Body of an HTML Document

Link to the challenge:

Hi sai0003,

Welcome to the forum!

An element that contains other elements is called a parent element. Elements that are part of another element are called child elements. For example, the html element is the parent element of the head and body elements, which in turn are its child elements.

Child elements can themselves also contain elements. They are then their parent element.

1 Like
<html> <!--parent element of  head and body-->
   <head> <!--child element of html-->
      ...
   </head>
   <body> <!--child element of html and parent element of p-->
     <p> ... </p>
   </body>
</html>

Hope this helps.

1 Like

there is no specific way to show, other than make so that an element is child of an other element

you need to add the head element and the body element, putting inside them the appopriate exisitng elements

As said before, if an element is to be a child element of another element, it must be inside (that is, between opening and closing tags of the parent element). This must be thought of as a hierarchical structure.

There can be only one html, head and body. In HTML5 there is always a head element; it is created by default. See HTMLHeadElement - Web APIs | MDN; it is what a JavaScript programmer would use to get the head element. It supports only one head element. A HTML document consists of a head element and a body element. If a head element is put in the body then it will not go into the body.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.