Which I can use? DIV or SECTION

Which one should I use to give my website a better structure.
I’ve been doing a lot of research but I just don’t understand it completely yet. Being more specific when, where and how I can use this kind of Tags.

Search with a term something like html semantics
That should help you clear things up but if you have a further question be more specific as to what you do not understand.

Hope that helps

1 Like

Hi!

The content inside a SECTION is “grouped” and represents a block in your page. This means that the content relates to a single theme. A section good example can be chapters of a book or numbered sections of a thesis.

See below code as example:

<section>
      <h3>Books</h3>
      <p>Learn HTML</p>
      <p>Learn CSS</p>
      <p>Learn Git</p>
      <p>Learn Javascript</p>
      <p>Learn PHP</p>
    </section>

A div is general. It doesn’t represent anything. It’s just to divide specific components.

As Roma advised, take a good read about html semantics as this will clear things up.

1 Like

Some links:

1 Like

i only recently started to use sections in my web pages and even articles. Sections id choose when i can split the info in my page into larger segments that can be considered on their own, when it comes to the content they offer. Regular divs for me are just the means to split your elements into groups, more of a technical purpose, to ease you structure your page, style it, give it the right appearance. Somtimes you’de use div just to have it as an image container, or to use it as a container or a flex child elements(or grid), or buttons container, or whatever. What im working right now is a mock restaurant site and as im writing the menu, i split the menu into sections- desserts, salads, pizza, etc and each item(a cheese cake, a tomato salad, or a margherita pizza), i put in its own article. Keep in mind, the use has quite wide range and its up to the designed, you could have your articles also contain sections and so on.

1 Like