美文网首页
拒绝滥用html标签

拒绝滥用html标签

作者: 肥羊猪 | 来源:发表于2021-01-15 16:35 被阅读0次

减少使用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

相关文章

  • 拒绝滥用html标签

    减少使用div class布局 不要滥用html标签div使用html5语义化标签 W3C标准

    一个页...

  • 前端优化总结

    html层级优化减少HTML的层级嵌套减少空标签、无用标签的滥用减少标签中style的使用,增加复用性,维护起来更...

  • 11. CSS综合

    我写代码时所遵守的代码规范 HTML 标签有始有终(闭合) 尽量遵循语义化,不滥用div 命名尽量通过功能命名,使...

  • Html 学习笔记

    HTML基础 HTML 标签 HTML 标记标签通常被称为 HTML 标签 (HTML tag) HTML 标签通...

  • HTML常用标签

    HTML标签:标记标签通常被称为HTML标签,HTML标签是HTML语言中最基本的单位,HTML标签是HTML最重...

  • 2018-06-04——HTML简介

    HTML 简介 HTML 标签 ·HTML 标记标签通常被称为 HTML 标签 (HTML tag)。 ·HTML...

  • 02.html

    Html结构标准 Html标签分类 单标签 双标签 Html标签关系分类 包...

  • HTML 常用的标签

    什么是 HTML 标签 HTML 文档和 HTML 元素是通过 HTML 标签进行标记的 HTML 标签由开始标签...

  • HTML笔记

    html标签与html元素 html标签: 由开始标签和结束标签组成的一对标签。 html元素: 从开始标签到结束...

  • HTML

    HTML简介 HTML的基本结构 HTML标签 基本标签 布局标签

网友评论

      本文标题:拒绝滥用html标签

      本文链接:https://www.haomeiwen.com/subject/uwswaktx.html