什么是HTML5?

HTML5,thelatestversionoftheHypertextMarkupLanguage(HTML),isthemostradicalrevision

ofthelanguagetodate.Itintroducesmanynewfeaturesinavarietyofareas.Someofthemore

notableadditionsinclude:

•Built-inmultimediatagsforaudioandvideo

•Acanvastagfordrawingcontentinthebrowser

•Smarterformsthatletyoudothingssuchasvalidationthroughtheuseofarequiredattribute

HTML5doctype

ThedoctypedeclarationshouldbethefirstthinginanHTMLdocument,beforethetag.

HTML4approach:

SimpleHTMLpageusingdivtags

<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>

<title>

ASimpleHTMLPageUsingDivs

</title>

</head>

<body>

<divid='header'>Header</div>

<divid='content'>Content</div>

<divid='footer'>Footer</div>

</body>

</html>

HTML5newtagsare:

1.header标记一个section的头部

2.section类似于一本书的章节

例子:

<header>Header</header>

<section>

<p>

Thisisanimportantsectionofthepage.

</p>

</section>

<divid='footer

3.article重要的内容块

例子:

<header>Header</header>

<section>

<article>

<p>

Thisisanimportantsectionofcontentonthepage.

Perhapsablogpost.

</p>

</article>

<article>

<p>

Thisisanimportantsectionofcontentonthepage.

Perhapsablogpost.

</p>

</article>

</section>

4.aside

例子:

<section>

<article>

<p>

Thisisanimportantsectionofcontentonthepage.

Perhapsablogpost.

</p>

<aside>

<p>

Thisisanasideforthefirstblogpost.

</p>

</aside>

</article>

<article>

ibm.com/developerWorks/developerWorks®

NewHTML5structuraltagsPage7of11

<p>

Thisisanimportantsectionofcontentonthepage.

Perhapsablogpost.

</p>

</article>

5.footer

6.nav