Upgrade to Pro — share decks privately, control downloads, hide ads and more …

解读HTML5

cssrain
September 02, 2014

 解读HTML5

解读HTML5

cssrain

September 02, 2014
Tweet

More Decks by cssrain

Other Decks in Technology

Transcript

  1. HTML5 HTML5 Powered with Connectivity / Realtime, Device Access, Graphics,

    3D &Effects, Multimedia, Performance &Integration, Semantics, and Offline &Storage © 亚信联创科技 新浪微博:@亚联UED 分享人:单东林 [email protected] 上海创新业务部门培训第03期(仅供内部培训使用) UED分享 · 交流 http://cssrain.github.io
  2. © 亚信联创科技 Contact 单东林 [email protected] 1,HTML的历史 2,HTML5是什么 3,HTML5的DOCTYPE 4,新的语义标签 5,表单新特性

    6,原生视频和音频支持 7,Web Socket通信 8,跨域访问 9,离线Web应用 10,本地存储-Web Storage 11,多线程-Web Workers 12,地理位置-Geolocation 13,绘图-Canvas 1 大致内容
  3. © 亚信联创科技 Contact 单东林 [email protected] HTML的历史 2 Tim Berners-Lee IETF

    W3C WHATWG 1991 HTML 1996 HTML 2 1997 HTML 3.2 1998 HTML 4 1999 HTML 4.01 2000 XHTML 1 2006 XHTML 2 2010 HTML 5
  4. © 亚信联创科技 Contact 单东林 [email protected] 4 <!DOCTYPE html PUBLIC "-//W3C//DTD

    XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> </head> <body> <div>此处省略10000字</div> </body> </html> Do you remember ?
  5. © 亚信联创科技 Contact 单东林 [email protected] 5 <!DOCTYPE html> <html> <head>

    <meta charset=“utf-8”> <title>HTML5 markup</title> </head> <body> <h1>Hello,HTML5!</h1> </body> </html> HTML5的DOCTYPE
  6. © 亚信联创科技 Contact 单东林 [email protected] 6 <html> <head> </head> <body>

    <div id="header"></div> <div id="nav"></div> <div id="content"> <h1>My Article</h1> </div> <div id="footer"> </div> </body> </html> 新的语义标签 <html> <head></head> <body> <header></header> <nav></nav> <section> <article></article> </section> <footer></footer> </body> </html>
  7. 7 表单新特性 Input: Number,Range,Date, Color,Search,Tel,Email, Url,List Eg: <input type="email“ />

    <input type="date“ /> <select data="http://domain/getcity"> </select> 新的控件类型 Required,min,max, multiple,pattern,low, high,optimum Eg: <input type="text" required > <input type="number" min=10 max=100 > 内置的表单验证 enctype="application/x-www- form+xml" Eg: <form action='/register' method="post“ enctype="application/x-www- form+xml" > XML提交类型 © 亚信联创科技 Contact 单东林 [email protected]
  8. Contact 单东林 [email protected] © 亚信联创科技 <object width="425" height="344"> <param name="movie“

    value="http://www.youtube.com/v/9sEI1AUFJKw"></param> <param name="allowFullScreen" value="true"></param> <param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/9sEI1AUFJKw" type="application/x- shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed> </object> <video width=”320” height=”240” controls preload> <source src="Ballmer_Developers_Developers.ogv" type='video/ogg; codecs="theora, vorbis"'> <source src="Ballmer_Developers_Developers.mp4" type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"> </video> <audio width=”320” height=”240” controls preload> <source src="Lili_Ivanova_Vetrove.mp3"> </audio> 10
  9. 13 跨域访问-cross document messaging © 亚信联创科技 Contact 单东林 [email protected] X

     Y Y  X var o = document.getElementsByTagName('iframe')[0]; o.contentWindow.postMessage('Hello world', 'http://b.example.org/');
  10. 18 绘图-Canvas © 亚信联创科技 Contact 单东林 [email protected] Eg: <canvas id="myCanvas"></canvas>

    <script > var canvas=document.getElementById('myCan vas'); var ctx=canvas.getContext('2d'); ctx.fillStyle='#FF0000'; ctx.fillRect(0,0,80,100); </script>