Welcome to the Treehouse Community
Looking to learn something new?
Sergey Pomaraiko5,572 Points
why we use so many div tags and never section tag?
In this example there is no one section tas. In which case we can use it?
Very good question. Most of the people don't write HTML how it should be written. Section and article tags are semantic elements and they should be used in proper way. So basically div tag should only be used when it's appropriate, when there's is really need for div because any other element doesn't work. Definitely div should not be used in example <div class="nav"><ul><li></li></ul></div> - most of the people write something like this but why use div with class nav when you have <nav> element. You should check out the documentation on using article, section, main, nav, header and footer.
I don't know about HTML Basics course but you should use <div> only when it's appropriate, that means only when anything else doesn't make sense. Maybe it's almost impossible to write everything 100% as it should be but you can get closer to that. Just read MDN page about HTML and semantic elements and you will get a much better understanding. People often use <div> because they are lazy to learn what is the purpose of semantic elements and why is <header> much better than <div class="header">. Most of the people don't know what looks like a well-structured document, it's not hard it just looks for a little more extra effort to learn those practices. <article>
- The article element represents a component of a page that consists of a self-contained composition in a document, page, application, or site and that is intended to be independently distributable or reusable, e.g. in syndication. <section>
- represents a standalone section — which doesn't have a more specific semantic element to represent it — contained within an HTML document. Typically, but not always, sections have a heading.