HTML5入門

HTML5?簡介

[if !vml]

[endif]

HTML5是HTML最新的修訂版本,2014年10月由萬維網(wǎng)聯(lián)盟(W3C)完成標準制定。

HTML5的設(shè)計目的是為了在移動設(shè)備上支持多媒體。

HTML5 簡單易學。

什么是HTML5?

HTML5 是下一代 HTML 標準。

HTML , HTML 4.01的上一個版本誕生于 1999 年。自從那以后,Web 世界已經(jīng)經(jīng)歷了巨變。

HTML5 仍處于完善之中。然而,大部分現(xiàn)代瀏覽器已經(jīng)具備了某些 HTML5 支持。

HTML5 是如何起步的?

HTML5 是 W3C 與 WHATWG 合作的結(jié)果,WHATWG 指 Web Hypertext

Application Technology Working Group。

WHATWG 致力于 web 表單和應用程序,而 W3C 專注于 XHTML 2.0。在 2006 年,雙方?jīng)Q定進行合作,來創(chuàng)建一個新版本的 HTML。

HTML5 中的一些有趣的新特性:

[if !supportLists]·????????[endif]用于繪畫的 canvas 元素

[if !supportLists]·????????[endif]用于媒介回放的 video 和 audio 元素

[if !supportLists]·????????[endif]對本地離線存儲的更好的支持

[if !supportLists]·????????[endif]新的特殊內(nèi)容元素,比如 article、footer、header、nav、section

[if !supportLists]·????????[endif]新的表單控件,比如 calendar、date、time、email、url、search

HTML5

聲明必須位于 HTML5 文檔中的第一行,使用非常簡單:

最小的HTML5文檔

下面是一個簡單的HTML5文檔:

文檔標題 文檔內(nèi)容......

注意:對于中文網(wǎng)頁需要使用

charset="utf-8">聲明編碼,否則會出現(xiàn)亂碼。

HTML5 的改進

[if !supportLists]·????????[endif]新元素

[if !supportLists]·????????[endif]新屬性

[if !supportLists]·????????[endif]完全支持CSS3

[if !supportLists]·????????[endif]Video 和Audio

[if !supportLists]·????????[endif]2D/3D 制圖

[if !supportLists]·????????[endif]本地存儲

[if !supportLists]·????????[endif]本地 SQL 數(shù)據(jù)

[if !supportLists]·????????[endif]Web 應用

HTML5 多媒體

使用 HTML5 你可以簡單的在網(wǎng)頁中播放 視頻(video)與音頻 (audio) 。

[if !supportLists]·????????[endif]HTML5?

[if !supportLists]·????????[endif]HTML5?

HTML5 應用

使用 HTML5 你可以簡單地開發(fā)應用

[if !supportLists]·????????[endif]本地數(shù)據(jù)存儲

[if !supportLists]·????????[endif]訪問本地文件

[if !supportLists]·????????[endif]本地 SQL 數(shù)據(jù)

[if !supportLists]·????????[endif]緩存引用

[if !supportLists]·????????[endif]Javascript 工作者

[if !supportLists]·????????[endif]XHTMLHttpRequest 2

HTML5 圖形

使用 HTML5 你可以簡單的繪制圖形:

[if !supportLists]·????????[endif]使用??元素。

[if !supportLists]·????????[endif]使用內(nèi)聯(lián)?SVG。

[if !supportLists]·????????[endif]使用?CSS3 2D 轉(zhuǎn)換CSS3 3D 轉(zhuǎn)換。

HTML5 使用CSS3

[if !supportLists]·????????[endif]新選擇器

[if !supportLists]·????????[endif]新屬性

[if !supportLists]·????????[endif]動畫

[if !supportLists]·????????[endif]2D/3D 轉(zhuǎn)換

[if !supportLists]·????????[endif]圓角

[if !supportLists]·????????[endif]陰影效果

[if !supportLists]·????????[endif]可下載的字體

了解更多CSS3知識請查看本站的?CSS3 教程。

語義元素

HTML5 添加了很多語義元素如下所示:

標簽描述

定義頁面獨立的內(nèi)容區(qū)域。

定義頁面的側(cè)邊欄內(nèi)容。

允許您設(shè)置一段文本,使其脫離其父元素的文本方向設(shè)置。

定義命令按鈕,比如單選按鈕、復選框或按鈕

用于描述文檔或文檔某個部分的細節(jié)

定義對話框,比如提示框

標簽包含 details 元素的標題

規(guī)定獨立的流內(nèi)容(圖像、圖表、照片、代碼等等)。

定義 元素的標題

定義 section 或 document 的頁腳。

定義了文檔的頭部區(qū)域

定義帶有記號的文本。

定義度量衡。僅用于已知最大和最小值的度量。

定義導航鏈接的部分。

定義任何類型的任務的進度。

定義 ruby 注釋(中文注音或字符)。

定義字符(中文注音或字符)的解釋或發(fā)音。

在 ruby 注釋中使用,定義不支持 ruby 元素的瀏覽器所顯示的內(nèi)容。

定義文檔中的節(jié)(section、區(qū)段)。

定義日期或時間。

規(guī)定在文本中的何處適合添加換行符。

HTML5 表單

新表單元素, 新屬性,新輸入類型,自動驗證。

已移除元素

以下的 HTML 4.01 元素在HTML5中已經(jīng)被刪除:

[if !supportLists]·????????[endif]

[if !supportLists]·????????[endif]

[if !supportLists]·????????[endif]

[if !supportLists]·????????[endif]

[if !supportLists]·????????[endif]

[if !supportLists]·????????[endif]

[if !supportLists]·????????[endif]

[if !supportLists]·????????[endif]

[if !supportLists]·????????[endif]

[if !supportLists]·????????[endif]

[if !supportLists]·????????[endif]

每一章中的實例

通過我們的 HTML 編輯器,您能夠編輯 HTML,然后點擊按鈕來查看結(jié)果。

實例

? 菜鳥教程(runoob.com)? 你的瀏覽器不支持 video 標簽。

嘗試一下 ?

點擊 "嘗試一下" 按鈕查看在線運行結(jié)果。

HTML5 瀏覽器支持

最新版本的 Safari、Chrome、Firefox 以及 Opera 支持某些 HTML5 特性。Internet Explorer 9 將支持某些 HTML5 特性。

[if !vml]

[endif]

IE9 以下版本瀏覽器兼容HTML5的方法,使用本站的靜態(tài)資源的html5shiv包:


9]>

src="http://cdn.static.runoob.com/libs/html5shiv/3.7/html5shiv.min.js">


載入后,初始化新標簽的CSS:

/*html5*/ article,aside,dialog,footer,header,section,nav,figure,menu{display:block}


+群289683894領(lǐng)取資料,交流學習

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容