What is the difference between div and header,main, section, aside and other html elements like this. Or even nav and footer. Is there a benefit of using header, main, section instead of a div ?
@NogDogJun 20.2019 — #> @DaveyErwin#1605159 the most common mistake HTML coders make with
> HTML5 is to use the aside tag for a sidebar
I might say it's using a DIV tag when something with more semantic meaning -- actually, _any_ semantic meaning -- could be used. :) But that goes back to older versions of HTML, not just 5.
@SempervivumJun 20.2019 — #One very concrete benefit of using a semantic tag is the following: When googling for images I often encounter the problem that some of the images don't match the search term. When using the figure tag there is a clear assignment between description or caption and image. Search engines should be able to find matching images more precisely.
@codyhillauthorJun 21.2019 — #@DaveyErwin#1605159@NogDog#1605163@Sempervivum#1605166 I use nav and footer and sometimes I also use header. But when it comes to the site content I use a div with a class , like <div class="about"> <div class="about__section-1"> </div> </div> .
The reason I am doing that is because sometimes the next section would have a different height , width or positioning. So I had to use a class anyway to target the specific section so I started using only divs instead. I did not knew that there is a big difference between the semantic elements. What would you suggest ?
@siddhi_patelJun 25.2019 — #Hello, there is some difference between this html tags.
<div> :
It defines a division or a section in an HTML document.
It is used to group block-elements to format them with CSS.
<section> :
It defines sections in a document, such as chapters, headers, footers, or any other sections of the document.
<header>:
There is a crucial difference between the header element and the general accepted usage of header (or masthead). There’s usually only one header or ‘masthead’ in a page. In HTML5 you can have as many as you want. The spec defines it as “a group of introductory or navigational aids”. You can use a header in any section on your site. In fact, you probably should use a header within most of your sections. The spec describes the section element as “a thematic grouping of content, typically with a heading.”
<aside>:
Used for tangentially related content. Just because some content appears to the left or right of the main content isn’t enough reason to use the aside element. Ask yourself if the content within the aside can be removed without reducing the meaning of the main content. Pullquotes are an example of tangentially related content.