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:

  1. page
    1. nav
    2. main
    3. sub
      1. aside
    4. 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:

  1. page
    1. nav
    2. main
    3. sub
      1. aside
  2. 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!

  1. use ranked <h1> <h6> headings instead of <h1>s. source
  2. wrap main content inside <main> element. remember set main { display: block } cross browser compatibility.
  3. put sidebar container (<aside>) inside <main> <aside> complementary content of <main>.
  4. 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>&copy; <time>2013</time> website name</small></p>     </footer>  </body> </html> 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -