May 21, 2013

Why cant we use <wrapper></wrapper>?

Shannon Hochkins’s Question:

I can use something like <section id="wrapper"></section>, however because I’m so pedantic, is there anything wrong with using <wrapper></wrapper> as my html element?

I’m using html5 shiv and modernizer, it does work fine however I just wanted to know if there’s anything particularly wrong with doing it this way.

<section> elements represent a section in the page, not YOUR LAYOUT. This is very important and is confused by most of starters in HTML5 including me.

Let me show where you are wrong, using another example:

<section id="banner">
</section>

Banners are a part of layout not web content. Thus they do not have any section. They have to represented by <div> as they used to be in HTML 4.

<section id="wrapper">...</section>

Is wrong in the same way, because wrappers are purely layout specific tasks, thus it does not represent any specific content on your page. <sections> should always represent differentiated content and not others.

Here is an example of HTML5, that can be considered valid.

<div id="wrapper">

    <section id="mainArticle">

    </section>
    <section id="aboutAuthor">

    </section>
    <aside id="relatedArticles">

    </aside>

</div>

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!