2011-08-26 455 views
1

我刚开始一个新的应用程序。以下是我负责做的基本模型。 我刚刚使用HTML5进行语义标记,所以我想要一些反馈/帮助。HTML5语义标记帮助

我想了解如何/在何处使用之类的东西<nav><section>

<div id="container"> 
    <header> 

    <div id="appInformation"> 
     <a href="#" alt="Home"> 
     <img src=""> 
     </a> 

     <span>Selected AppName</span> 
    </div> 

    <div> 
     <span id="time">TIME GOES HERE</span> 
    </div> 

    <div> 
     <a href="#" alt="Additional Information"> 
     <img src=""><!-- This is will be the location of the the 'i'--> 
     </a> 
    </div> 

    <div class=""> 
     <label>UserName</label> 
    </div> 

    </header> 
    <div id="main"> 
     <!-- main content for the selected app here --> 
    </div> 

    <footer> 

     <div id="appVersion"> 
      VERSION # HERE 
     </div> 

     <nav> 
      <ul> 
       <li> 
        <a href="#">FAQ</a> 
       </li> 
      </ul> 
     </nav> 

     <div id=""> 
      <!-- Team logo here--> 
     </div> 

    </footer> 

enter image description here

回答

3
  • 避免unacessary事业部。
  • 对时间元素使用时间标记而不是Div。
  • 如果您没有任何可以引用的内容(如输入内容),请避免使用标签。

    选择AppName的
    <time datetime="YYYY-MM-DD">TIME GOES HERE</time><!-- Don't need an id Time since you can target the Time tag --> 
    
        <a href="#" alt="Additional Information"> 
         <img src=""><!-- This is will be the location of the the 'i'--> 
        </a> 
    
        <em>UserName</em> <!-- Don't use a label if you got nothing to refer too, like an input for example. --> 
    </header> 
    <div id="main"> 
        <!-- main content for the selected app here --> 
    </div> 
    <footer> 
        <div id="appVersion"> 
         VERSION # HERE 
        </div> 
        <nav> 
         <ul> 
          <li> 
           <a href="#">FAQ</a> 
          </li> 
         </ul> 
        </nav> 
    
        <a href="yourTeamUrl" id=""> 
         <!-- Team logo here--> 
        </a> 
    </footer> 
    
1

除了@Simon阿诺德的优良的答案,我可能也表明<nav>使用是不正确。页脚中的单个链接很难被解释为“主要导航块”。请参阅http://dev.w3.org/html5/spec/sections.html#the-nav-element

+0

绿色文字的第一个注释可能会有像3-4个链接,随着时间的推移可能会略有增长。如果是这种情况,这是否会改变事情? –

+0

这确实是一个判断呼吁。如果您认为这组链接是您网站的主要导航区块,那么可以使用它。然而,对于一个主要的导航块来说,在一个'

'中是最不寻常的,因此可以考虑将它移出。如果你想要的样式,你仍然可以将它放在页面的底部,但在语义上它似乎是一个不太可能的安排。 – Alohci

+0

是的,我同意它肯定不是一个主要的导航栏。 –