HTML5 semantic ...LOGIN

HTML5 semantic elements

HTML5 Semantic Element

Semantic = meaning.

Semantic Element = Meaning of element.

What is a semantic element?

A semantic element can Clearly describe its meaning to browsers and developers.

Semantic element examples: <div> and <span> - no need to consider content.

Semantic element examples: <form>, <table>, and <img> - clearly defines its content.

No semantic element examples: <div> and <span> - No need to consider the content.
Semantic element examples: <form>, <table> , and <img> - clearly defines its content.

<title> is a typical semantic tag that defines the title of the document.

New semantic elements in HTML5
Many existing websites contain the following HTML code: <div id="nav">, <div class="header">, or <div id="footer">, to indicate navigation Links, headers, and trailers.

HTML5 provides new semantic elements to identify different parts of a Web page:
<header>
<nav>
<section> ;
<article>
<aside>
<figcaption>
<figure>
<footer>

HTML5 <section> Element

<section> tag defines a section (section, section) in the document. Such as chapters, headers, footers, or other parts of the document.

According to W3C HTML5 documentation: section contains a set of content and its title.

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title></title> 
</head>
<body>
<section>
  <h1>沁园春 雪</h1>
  <p>北国风光, 千里冰封, 万里雪飘。 望长城内外, 惟余茫茫。 大河上下, 顿失滔滔。 山舞银蛇, 原驰蜡象。 欲与天公誓比高。 须睛日, 看红装素裹, 分外妖娆。 江山如此多娇, 引无数英雄竞折腰。 昔秦皇汉武, 略疏文采; 唐宗宋祖, 稍逊风骚。 一代天骄, 成吉思汗, 只识弯弓射大雕。 俱往矣, 数风流人物, 还看今朝。</p>
</section>
<section>
  <h1>我爱这土地</h1>
  <p>假如我是一只鸟, 我也应该用嘶哑的喉咙歌唱: 这被暴风雨所打击着的土地, 这永远汹涌着我们的悲愤的河流, 这无止息地吹刮着的激怒的风, 和那来自林间的无比温柔的黎明</p>
</section>
</body>
</html>

HTML5 <article> Element

<article> tag defines independent content. .

<article> Element usage example:

Forum post

Blog post

News story

Comment

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>php中文网(php.cn)</title> 
</head>
<body>
<article>
  <h1>Internet Explorer 9</h1>
  <p> Windows Internet Explorer 9(缩写为 IE9 )在2011年3月14日21:00 发布。</p>
</article>
</body>
</html>

HTML5 <nav> Element The

<nav> tag defines the portion of the navigation link. The

<nav> element is used to define the navigation link area of ​​the page. However, not all links need to be included in the <nav> element!


HTML5 <aside> Element The

<aside> tag defines content outside the main area of ​​the page (such as a sidebar).

The content of the aside tag should be related to the content of the main area.

HTML5 <header> element

<header> element describes the head area of ​​the document

<header> element Note that it is used to define the introductory display area of ​​the content.

You can use multiple <header> elements in the page.

HTML5 <footer> Element

The<footer> element describes the bottom area of ​​the document.

The<footer> element should contain its containing element

A footer usually contains the author of the document , copyright information, linked terms of use, contact information, etc.

You can use multiple <footer> elements in the document.

HTML5 <figure> and <figcaption> elements

The

<figure> tag specifies independent stream content (images, charts, photos, code, etc.). The content of the

<figure> element should be related to the main content, but should have no impact on document flow if removed.

<figcaption> tag defines the title of the <figure> element.

The<figcaption> element should be placed as the first or last child element of the "figure" element. .

Write a comprehensive example and you will understand after comparing it:

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>语义元素</title>
</head>
<body>
    <!--结构元素-->
    <header>头部</header>
    <section>表示一个段落:用于区域的章节表述</section>
    <footer>区域的页脚部分</footer>
    <nav>菜单 导航</nav>
    <article>表示文章的主体内容</article>
    <!--块级元素 用于区域的划分-->
    <aside></aside>
    <figure>
        <figcaption></figcaption>
    </figure>
    <code>表示一段代码</code>
    <dialog>表示对话
        <dt>说话的人</dt><dd>内容</dd>
    </dialog>
    <!--语义元素-->
    <mtter>一定范围的数值</mtter>
    <time></time>
    <progress>进度条</progress>
    <video>视频</video>
    <audio>音频</audio>
    <!--交互元素-->
    <details>一段具体内容 通过某个方法显示</details>
    <datagrid>用来控制客户端数据显示</datagrid>
    <menu>动态交互菜单</menu>
    <command>命名</command>
    <!--显示文章案例-->
    <article>
        <header>
            <h1>HTML head 头部分的标签</h1>
            <time>2015年12月12日</time>
        </header>
        <p>HTML head 头部分的标签、元素有很多,涉及到浏览器对网页的渲染,SEO等等,而各个浏览器内核以及各个国内浏览器厂商都有些自己的标签元素,这就造成了很多差异性。移动互联网时代,head 头部结构,移动端的meta 元素,显得更为重要。了解每个标签的意义,写出满足自己需求的head 头标签,是本文的目的。本篇以一丝的文章为基础,进行扩展总结介绍常用的head中各个标签、元素的意义以及使用场景。</p>
        <footer>
            <p>http://www.baidu.com</p>
        </footer>
    </article>
    <!--评论-->
    <section>
    <h2>评论</h2>
        <article>
            <header>
                <h3>张帅</h3>
                <p><time pubdata datatime="2013-09-23 10:00 - 11:00">一小时前</time></p>
            </header>
            <p>评论内容</p>
        </article>
        <article>
            <header>
                <h3>张帅</h3>
                <p><time pubdata datatime="2013-09-23 10:00 - 11:00">一小时前</time></p>
            </header>
            <p>评论内容</p>
        </article>
    </section>
</body>
</html>


Next Section
<!doctype html> <html> <head> <meta charset="UTF-8"> <title>语义元素</title> </head> <body> <!--结构元素--> <header>头部</header> <section>表示一个段落:用于区域的章节表述</section> <footer>区域的页脚部分</footer> <nav>菜单 导航</nav> <article>表示文章的主体内容</article> <!--块级元素 用于区域的划分--> <aside></aside> <figure> <figcaption></figcaption> </figure> <code>表示一段代码</code> <dialog>表示对话 <dt>说话的人</dt><dd>内容</dd> </dialog> <!--语义元素--> <mtter>一定范围的数值</mtter> <time></time> <progress>进度条</progress> <video>视频</video> <audio>音频</audio> <!--交互元素--> <details>一段具体内容 通过某个方法显示</details> <datagrid>用来控制客户端数据显示</datagrid> <menu>动态交互菜单</menu> <command>命名</command> <!--显示文章案例--> <article> <header> <h1>HTML head 头部分的标签</h1> <time>2015年12月12日</time> </header> <p>HTML head 头部分的标签、元素有很多,涉及到浏览器对网页的渲染,SEO等等,而各个浏览器内核以及各个国内浏览器厂商都有些自己的标签元素,这就造成了很多差异性。移动互联网时代,head 头部结构,移动端的meta 元素,显得更为重要。了解每个标签的意义,写出满足自己需求的head 头标签,是本文的目的。本篇以一丝的文章为基础,进行扩展总结介绍常用的head中各个标签、元素的意义以及使用场景。</p> <footer> <p>http://www.baidu.com</p> </footer> </article> <!--评论--> <section> <h2>评论</h2> <article> <header> <h3>张帅</h3> <p><time pubdata datatime="2013-09-23 10:00 - 11:00">一小时前</time></p> </header> <p>评论内容</p> </article> <article> <header> <h3>张帅</h3> <p><time pubdata datatime="2013-09-23 10:00 - 11:00">一小时前</time></p> </header> <p>评论内容</p> </article> </section> </body> </html>
submitReset Code
ChapterCourseware