拒绝滥用html标签

减少使用div class布局 不要滥用html标签div
使用html5语义化标签 W3C标准 <main>一个页面一次只能显示一个

<header>, <main>, <footer>和<section>
<article>
    <header>
        <h1>Why you should buy more cheeses than you currently do</h1>
    </header>
    <section>
        <header>
            <h2>Part 1: Variety is spicy</h2>
        </header>
        <!-- 内容 -->
    </section>
    <section>
        <header>
            <h2>Part 2: Cows are great</h2>
        </header>
        <!-- 更多内容 -->
    </section>
</article>
导航栏 一目了然而不需要在<div>上读物和处理类名来找到它,更重要的是机器也可以找到它
<nav>
    <a href="/">Home</a>
    <a href="/about">About</a>
    <a href="/archive">Archive</a>
</nav>

<address> 元素旨在调出联系信息,它通常在主页<footer>中用于标记企业的邮寄地址,电话号码,客户服务邮箱地址等等。


<footer>
    <section class="contact" vocab="http://schema.org/" typeof="LocalBusiness">
        <h2>Contact us!</h2>
        <address property="email">
            <a href="mailto:us@example.com">us@example.com</a>
        </address>
        <address property="address" typeof="PostalAddress">
            <p property="streetAddress">123 Main St., Suite 404</p>
            <p>
                <span property="addressLocality">Yourtown</span>,
                <span property="addressRegion">AK</span>,
                <span property="postalCode">12345</span>   
            </p>
            <p property="addressCountry">United States of America</p>
        </address>
    </section>
</footer>

<header>
    <h1>Super duper best blog ever</h1>
    <nav>
        <a href="/">Home</a>
        <a href="/about">About</a>
        <a href="/archive">Archive</a>
    </nav>
</header>
<main>
    <article>
    <header>
        <h1>Why you should buy more cheeses than you currently do</h1>
    </header>
    <section>
        <header>
            <h2>Part 1: Variety is spicy</h2>
        </header>
        <!-- cheesy content -->
    </section>
    <section>
        <header>
            <h2>Part 2: Cows are great</h2>
        </header>
        <!-- more cheesy content -->
    </section>
</article>
</main>
<footer>
    <section class="contact" vocab="http://schema.org/" typeof="LocalBusiness">
        <h2>Contact us!</h2>
        <address property="email">
            <a href="mailto:us@example.com">us@example.com</a>
        </address>
        <address property="address" typeof="PostalAddress">
            <p property="streetAddress">123 Main St., Suite 404</p>
            <p>
                <span property="addressLocality">Yourtown</span>,
                <span property="addressRegion">AK</span>,
                <span property="postalCode">12345</span>   
            </p>
            <p property="addressCountry">United States of America</p>
        </address>
    </section>
</footer>

参考: https://github.com/reng99/blogs/issues/16

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • DIVS该停止(滥用)了 我们喜欢(使用) 标签。它们已经存在了几十年,这几十年来,当需要将一些内容包裹起来达到(...
    Ming_Hu阅读 306评论 0 0
  • 其实对HTML说不上陌生也不算熟悉,准确的说是从来没有考虑过要看官方文档,每次都是停留在浅尝辄止的水平保持够用就好...
    CoderMageFox阅读 1,007评论 0 0
  • 作者:彭志明 日期:2017年4月29日 HTML5中部分标签在特定条件下可以省略,而不影响文档的正确性与规范...
    pz明阅读 461评论 0 0
  • WebRTC 介绍 官网,官方的Getting Started。Google关于WebRTC的幻灯片 然后是Web...
    Crassus阅读 2,491评论 0 12
  • 这块内容分成下面5个部分:1.HTML常见元素和理解。2.HTML版本。3.HTML元素分类。4.HTML元素的嵌...
    平凡的lily阅读 627评论 0 0