Use tag section within an aside

6

My tag is as follows:

<aside>
    <div class="last-news">
        Conteudo
    </div>
     <div class="social">
        Conteudo
    </div>
     <div class="links">
        Conteudo
    </div>
</aside>

What would be most appropriate in the case: <div> or <section> ?

Using <section> within a <aside> would be semantically incorrect?

    
asked by anonymous 18.02.2014 / 19:42

2 answers

4

You could use <section> within <aside> , the point is you have to see if that makes sense.

Eventually, you can sweat even more <aside> tags rather than make your proposal.

Now, the main problem I see in your code is that it does not have any element of type <h1> , <h3> , <h3> ..., and that means you're not really improving its semantic structure .

The least you need to know

First, create your page and use a tool that shows you the outline of it. It could be the link or link .

In the current code

<aside>
    <div class="last-news">
        Conteudo
    </div>
     <div class="social">
        Conteudo
    </div>
     <div class="links">
        Conteudo
    </div>
</aside>

The outline is

1. Untitled Section
   2. Untitled Section

Untitled Section is bad. Semantically it tends to be even better to just use direct headers than simply randomly add new HTML5 elements

In a semantic structure to allow the aside you would have to have at least the following:

<aside>
    <h1>Lateral</h1>
    <div class="last-news">
        Conteudo
    </div>
     <div class="social">
        Conteudo
    </div>
     <div class="links">
        Conteudo
    </div>
</aside>

The outline is

1. Untitled Section ### Ignore, como não estou colocando o HTML inteiro
                    ### aparece isso. Precisaria ter um h1 na raiz do site
   2. Lateral

In the above situation, you would in hypothesis some could use any other securing element in place of divs, because it would be a mistake.

However, if within your divs you have at least one header, in this case you could use <section> or another element that makes sense in the specific context. Most new tags that generate a semantic context require that you have at least one header.

Then answering your question: if you do not use headers, you can not use headers, and if you use headers, could use sectional elements if it is worth creating a new context where the information has a different meaning to the parent section.

    
18.02.2014 / 19:47
1

From the specification :

  

Examples of sections would be chapters, the various tabbed pages in a tabbed dialog box, or the numbered sections of a thesis. The Web site's home page could be split into sections for an introduction, news items, and contact information .

Since it's splitting sections of the code is correct to use, it's even better if you use headers within those sections, as the specification recommends.

It would be incorrect to use <section> for other uses, but to separate sections, such as styling a part of the page or creating columns: use <div> for this, and if you are going to create a sidebar or give related information previous content, <aside> .

    
18.02.2014 / 19:51