Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: HTML5 Help

  1. #1
    New Coder
    Join Date
    Sep 2010
    Posts
    67
    Thanks
    9
    Thanked 0 Times in 0 Posts

    HTML5 Help

    Would including the site navigation inside the "header" tags be valid in html5?

    Code:
    <header id="top_header">
              <h1>Football Club</h1>
                
          <section id="main_content">  
          <nav id="top_menu">
               <ul>
                   <li><a href="#">Home</a></li>
                   <li><a href="league-table.html" onclick="this.target='blank'">League Table</a></li>
                   <li><a href="fixtures.html" onclick="this.target='blank'">Fix & Res</a></li>
                   <li><a href="#">HotShots</a></li>
                   <li><a href="#">Profiles</a></li>
                   <li><a href="players.html" onclick="this.target='blank'">Squad-List</a></li>
               </ul>
          </nav>
          
          </header>
    Last edited by Frump; 08-05-2012 at 10:24 AM.

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,876
    Thanks
    6
    Thanked 1,035 Times in 1,008 Posts
    What does the HTML validator say?

  • #3
    Regular Coder
    Join Date
    Jul 2012
    Location
    London
    Posts
    473
    Thanks
    4
    Thanked 86 Times in 86 Posts
    Line 1, Column 39: Element head is missing a required instance of child element title.
    Code:
    <!DOCTYPE html><header id="top_header">
    Content model for element head:
    If the document is an iframe srcdoc document or if title information is available from a higher-level protocol: Zero or more elements of metadata content.
    Otherwise: One or more elements of metadata content, of which exactly one is a title element.

    Line 16, Column 15: End tag header seen, but there were open elements.
    Code:
          </header>

    Line 4, Column 33: Unclosed element section.
    Code:
          <section id="main_content">

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,876
    Thanks
    6
    Thanked 1,035 Times in 1,008 Posts
    <header> is not <head>. While explicitly writing out the <head> and <body> elements is optional (they are implied if not present in the code), you still need a <title> in the document. The <header> element can only be a child of either <article>, <aside>, or <section> and not vice versa (i. e. you can’t have <section> inside <header>).

  • #5
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,372
    Thanks
    32
    Thanked 286 Times in 280 Posts
    Quote Originally Posted by Frump View Post
    Would including the site navigation inside the "header" tags be valid in html5?
    Yes. Per http://www.whatwg.org/specs/web-apps...header-element, header elements may contain "flow content" minus header and footer elements. Flow content includes the nav element.

    Worth noting that onclick="this.target='blank'" would be better written as target="_blank". There's no need to use JavaScript to do something that can be done directly with HTML.
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #6
    New Coder
    Join Date
    Sep 2010
    Posts
    67
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Thanks for all the help and advice folks!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •