freeCodeCamp Challenge Guide: Nest Many Elements within a Single Div Element

freeCodeCamp Challenge Guide: Nest Many Elements within a Single Div Element
0.0 0

#1

The div element, also known as a division element, is a general purpose container for other elements.

The div element is probably the most commonly used HTML element of all. It’s useful for passing the CSS of its own class declarations down to all the elements that it contains.

Just like any other non-self-closing element, you can open a div element with <div> and close it on another line with </div>.

<div>
 <p>Things cats love:</p>
 <ul>
   <li>cat nip</li>
   <li>laser pointers</li>
   <li>lasagna</li>
 </ul>
 <p>Top 3 things cats hate:</p>
 <ol>
   <li>flea treatment</li>
   <li>thunder</li>
   <li>other cats</li>
 </ol>
</div>
>

#2

I don’t understand. What’s the difference when we don’t use the ‘div’ element?