2012-03-20 58 views
0

我应该在我的新网站上使用HTML5特定标记进行搜索,以便我可以保持语义正确吗? 我的网站的结构是这样的我应该使用HTML5标记进行搜索吗?

-------------------- 
     Header 
-------------------- 
search | nav 
-------------------- 
     article 
-------------------- 
     footer 
-------------------- 

这是我所关注的主要是因为搜索扮演这个页面上的一个重要角色。

回答

3

您可以使用:

<input type="search"> 

搜索导航网站的一种方式,所以你可以只将它添加到<nav>元素。

在这种情况下,<nav>元素可能是<header>,just like the last example in the spec的子元素。

<header> 
    <h1>Site title</h1> 
    <input type="search" placeholder="Search…"> 
    <nav> 
    … 
    </nav> 
</header> 
<article> 
    <h1>Page title</h1> 
</article> 
<footer> 
    … 
</footer> 
+0

我读到这个方法,但我不知道该

0

您的结构应该这样(如果你遵循HTML5):

<header>this is header</header> 

<section> 
    <section> 
     <form> 
      <input type="search"> 
     </form> 
    </section> 
    <nav> 
     this is navigation 
    </nav> 
</section> 

<main> 
    <article>this content article</article> 
    <aside>this sidebar</aside> 
</main> 


<footer>this is footer</footer> 
相关问题