Do we ever need <div>?

In the lessons about semantic HMTL, I found that what kept happening was that I was told “instead of this <div>, let’s use something else, such as <section>, <header>, <article> etc.” So what I’m wondering is, is <div> ever actually needed, or is it kind of just a stepping stone to more elegant semantic HTML? Or none of these?

Hi, there!

Welcome to the forums!

<div>s are still needed, just like <span>. In the lesson, when it wants you to replace <div> with semantic elements, it is explaining you should not use <div> in place of those elements.

<div> is used for grouping and styling elements outside of semantic meaning. Many times, you will see people using them as wrappers. I encourage you to inspect the web pages you visit to see how they use <div>s.

I hope this makes sense! Let me know if you have any other questions. :slight_smile:

Happy coding!

1 Like

Okay. I guess I just need more experience both observing HTML and writing my own to figure out how to use them.

1 Like

Most definitely! The more you practice, the more familiar you’ll become.

Just don’t forget your community if you need any more assistance! :sunglasses: