html - HTML5 semantics & outlines -
i discovered whole html outline thing , found great online html5 outliner tool. i'm trying accomplish semantically proper simple html page outline should this:
- page
- nav
- main
- sub
- aside
- footer
and render page this:
| --- nav ----------------- | | content | | --- main ---------------- | | content | | --- sub ----------------- | | content | aside | | --- footer -------------- | | content |
the html looks follows:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>title</title> </head> <body> <div class="page"> <header class="page--header"> <hgroup> <h1>page</h1> <h2>subtitle</h2> </hgroup> <nav> <h1>nav</h1> <ul> <li>link 1</li> <li>link 2</li> <li>link 3</li> <li>link 4</li> <li>link 5</li> </ul> </nav> </header><!-- .page-header --> <section class="page--main"> <h1>main</h1> </section><!-- .page-main --> <section class="page--sub"> <h1>sub</h1> <aside> <h1>aside</h1> <p>advertisement block</p> </aside><!-- aside --> </section><!-- .page-sub --> <footer> <h1>footer</h1> </footer><!-- footer --> </div><!-- .page --> </body> </html>
that makes outline this:
- page
- nav
- main
- sub
- aside
- footer
how should alter html keep semantically correct while getting outline mentioned above? how come footer
not outlined on same level top-level section elements (ie. main & sub) when siblings same heading-level?
confused, , help, criticism or suggestions welcome, thanks!
- use ranked
<h1>
<h6>
headings instead of<h1>
s. source - wrap main content inside
<main>
element. remember setmain { display: block }
cross browser compatibility. - put sidebar container (
<aside>
) inside<main>
<aside>
complementary content of<main>
. - remove
<h1>
inside<footer>
<footer>
not sectioning element doesn't need heading.
brief example:
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>title</title> </head> <body> <header role="banner"> <hgroup> <h1>page</h1> <h2>subtitle</h2> </hgroup> <nav role="navigation"> <h2>nav</h2> <ul> <li>link 1</li> <li>link 2</li> <li>link 3</li> <li>link 4</li> <li>link 5</li> </ul> </nav> </header> <main role="main"> <!-- main content goes here --> <section id="example"> <h2>example</h2> <p>lorem ipsum</p> </section> <!-- main content goes here --> <aside role="complementary"> <h2>aside</h2> <article id="ad"> <h3>ad</h3> <p>advertisement block</p> </article> </aside> </main> <footer role="contentinfo"> <p><small>© <time>2013</time> website name</small></p> </footer> </body> </html>
Comments
Post a Comment