6.HTML5页面结构
01 | <!DOCTYPE HTML> |
02 | < html > |
03 | < head > |
04 | < meta http-equiv = "Content-Type" content = "text/html; charset=UTF-8" /> |
05 | < title >Your Website</ title > |
06 | </ head > |
07 | < body > |
08 | < header > |
09 | < nav > |
10 | < ul > |
11 | < li >Your menu</ li > |
12 | </ ul > |
13 | </ nav > |
14 | </ header > |
15 | < section > |
16 | < article > |
17 | < header > |
18 | < h2 >Article title</ h2 > |
19 | < p >Posted on < time datetime = "2009-09-04T16:31:24+02:00" >September 4th 2009</ time > by < a href = "#" >Writer</ a > - < a href = "#comments" >6 comments</ a ></ p > |
20 | </ header > |
21 | < p >Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</ p > |
22 | </ article > |
23 | < article > |
24 | < header > |
25 | < h2 >Article title</ h2 > |
26 | < p >Posted on < time datetime = "2009-09-04T16:31:24+02:00" >September 4th 2009</ time > by < a href = "#" >Writer</ a > - < a href = "#comments" >6 comments</ a ></ p > |
27 | </ header > |
28 | < p >Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</ p > |
29 | </ article > |
30 | </ section > |
31 | < aside > |
32 | < h2 >About section</ h2 > |
33 | < p >Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</ p > |
34 | </ aside > |
35 | < footer > |
36 | < p >Copyright 2009 Your name</ p > |
37 | </ footer > |
38 | </ body > |
39 | </ html > |
7.上下文菜单
1 | < section contextmenu = "mymenu" > |
2 | < p >Yes, this section right here</ p > |
3 | </ section > |
4 | < menu type = "context" id = "mymenu" > |
5 | < menuitem label = "Please do not steal our images" icon = "img/forbidden.png" ></ menuitem > |
6 | < menu label = "Social Networks" > |
7 | < menuitem label = "Share on Facebook" onclick = "window.location.href = 'http://facebook.com/sharer/sharer.php?u=' + window.location.href;" > </ menuitem > |
8 | </ menu > |
9 | </ menu > |
8.HTML5 Datalist
1 | < input name = "frameworks" list = "frameworks" /> |
2 | < datalist id = "frameworks" > |
3 | < option value = "MooTools" > |
4 | < option value = "Moobile" > |
5 | < option value = "Dojo Toolkit" > |
6 | < option value = "jQuery" > |
7 | < option value = "YUI" > |
8 | </ datalist > |
9.从谷歌地图上获取路线
1 | < form action = "http://maps.google.com/maps" method = "get" target = "_blank" > |
2 | < label for = "saddr" >Enter your location</ label > |
3 | < input type = "text" name = "saddr" /> |
4 | < input type = "hidden" name = "daddr" value = "350 5th Ave New York, NY 10018 (Empire State Building)" /> |
5 | < input type = "submit" value = "Get directions" /> |
6 | </ form > |
10.HTML5电子邮件正则表达式验证
1 | < input type = "text" title = "email" required pattern = "[^@]+@[^@]+\.[a-zA-Z]{2,6}" /> |