<div> or not to </div>?

When I used < div > < /div > nested < p > and < /ol > (including < /p >) the webpage make nothing. Which is the sense of < div >< /div > in this context? The lesson “say” “is for general purpose”.
What is a general purpose?
Tell another programmer that among those “div” there are “certain things”?
Wouldn’t it be better to use ← - - - - ->?
For example: “<- - - between < div > and < /div > you will find such elements - - ->”

Sorry for the spaces between sentences, but, the system did not let me publish them in my comments.

MY CODE (with any trouble)

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

<p>Click here to view more <a href="#">cat photos</a>.</p>

<a href="#"><img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>

<p>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>
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36 Edg/89.0.774.68.

Challenge: Crea una lista no ordenada

Link to the challenge:

1 Like

You use it to group things, then you can apply styles to the whole group, or position it on the page or whatever. It’s much easier to style or position one element than it is to style or position lots of elements. It’s just a box to put stuff in, boxes to put stuff in are generally very useful.

1 Like

Very nice reply Dan. Excellent argument.
I will go forward with this adventure (for me :))

1 Like

Personally I use it with a class or an ID so I can style it with CSS later. For example, <div> means very little, but if you put <div id="main"> or <div class="main">, then later on you can style the whole #main or .main in CSS.

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