1. еÄDoctype
¾¡¹ÜʹÓÃ<!DOCTYPE html>£¬¼´Ê¹ä¯ÀÀÆ÷²»¶®Õâ¾ä»°Ò²»á°´ÕÕ±ê׼ģʽȥäÖȾ
2. FigureÔªËØ
ÓÃ<figure>ºÍ<figcaption>À´ÓïÒ廯µØ±íʾ´ø±êÌâµÄͼƬ
- <figure>
- <img src=”path/to/image” alt=”About image” />
- <figcaption>
- <p>This is an image of something interesting. </p>
- </figcaption>
- </figure>
3. ÖØж¨ÒåµÄ<small>
<small>ÒѾ±»ÖØж¨ÒåÁË£¬ÏÖÔÚ±»ÓÃÀ´±íʾСµÄÅŰ棬ÈçÍøÕ¾µ×²¿µÄ°æȨÉùÃ÷
4. È¥µôlinkºÍscript±êÇ©ÀïÃæµÄtypeÊôÐÔ
5. ¼Ó/²»¼Ó À¨ºÅ
HTML5ûÓÐÑϸñµÄÒªÇóÊôÐÔ±ØÐë¼ÓÒýºÅ£¬±ÕºÏ²»±ÕºÏ£¬µ«Êǽ¨Òé¼ÓÉÏÒýºÅºÍ±ÕºÏ±êÇ©
6. ÈÃÄãµÄÄÚÈݿɱ༣¬Ö»ÐèÒª¼ÓÒ»¸öcontenteditableÊôÐÔ
7. Email Inputs
Èç¹ûÎÒÃǸøInputµÄtypeÉèÖÃΪemail£¬ä¯ÀÀÆ÷¾Í»áÑéÖ¤Õâ¸öÊäÈëÊÇ·ñÊÇemailÀàÐÍ£¬µ±È»²»ÄÜÖ»ÒÀÀµÇ°¶ËµÄУÑ飬ºó¶ËÒ²µÃÓÐÏàÓ¦µÄУÑé
8. Placeholders
Õâ¸öinputÊôÐÔµÄÒâÒå¾ÍÊDz»±Øͨ¹ýjavascriptÀ´×öplaceholderµÄЧ¹ûÁË
ʹÓÃLocal Storage¿ÉÒÔÓÀ¾Ã´æ´¢´óµÄÊý¾ÝƬ¶ÎÔÚ¿Í»§¶Ë£¨³ý·ÇÖ÷¶¯É¾³ý£©£¬Ä¿Ç°´ó²¿·Öä¯ÀÀÆ÷ÒѾ֧³Ö£¬ÔÚʹÓÃ֮ǰ¿ÉÒÔ¼ì²âÒ»ÏÂwindow.localStorageÊÇ·ñ´æÔÚ
10. ÓïÒ廯µÄheaderºÍfooter
11. ¸ü¶àµÄHTML5±íµ¥ÌØÐÔ
12. IEºÍHTML5
ĬÈϵģ¬HTML5ÐÂÔªËر»ÒÔinlineµÄ·½Ê½äÖȾ£¬²»¹ý¿ÉÒÔͨ¹ýÏÂÃæÕâÖÖ·½Ê½ÈÃ
ÆäÒÔblock·½Ê½äÖȾ
- header, footer, article, section, nav, menu, hgroup {
- display: block;
- }
²»ÐÒµÄÊÇIE»áºöÂÔÕâЩÑùʽ£¬¿ÉÒÔÏñÏÂÃæÕâÑùfix:
- document.createElement(”article”);
- document.createElement(”footer”);
- document.createElement(”header”);
- document.createElement(”hgroup”);
- document.createElement(”nav”);
- document.createElement(”menu”);
13. hgroup
Ò»°ãÔÚheaderÀïÃæÓÃÀ´½«Ò»×é±êÌâ×éºÏÔÚÒ»Æð£¬Èç
- <header>
- <hgroup>
- <h1> Recall Fan Page </h1>
- <h2> Only for people who want the memory of a lifetime. </h2>
- </hgroup>
- </header>
14. RequiredÊôÐÔ
requiredÊôÐÔ¶¨ÒåÁËÒ»¸öinputÊÇ·ñÊDZØÐëµÄ£¬Äã¿ÉÒÔÏñÏÂÃæÕâÑùÉùÃ÷
- <input type=”text” name=”someInput” required>
- <!--»òÕß-->
- <input type=”text” name=”someInput” required=”required”>
15. AutofocusÊôÐÔ
ÕýÈçËüµÄ´ÊÒ壬¾ÍÊǾ۽¹µ½ÊäÈë¿òÀïÃæ
- <input type=”text” name=”someInput” placeholder=”Douglas Quaid” required autofocus>
16. AudioÖ§³Ö
HTML5ÌṩÁË<audio>±êÇ©£¬Äã²»ÐèÒªÔÙ°´ÕÕµÚÈý·½²å¼þÀ´äÖȾÒôƵ£¬´ó¶àÊýÏÖ´úä¯ÀÀÆ÷ÌṩÁ˶ÔÓÚHTML5 AudioµÄÖ§³Ö£¬²»¹ýÄ¿Ç°ÈÔ¾ÉÐèÒªÌṩһЩ¼æÈÝ´¦Àí£¬Èç
- <audio autoplay=”autoplay” controls=”controls”>
- <source src=”file.ogg” /><!–FF–>
- <source src=”file.mp3″ /><!–Webkit–>
- <a href=”file.mp3″>Download this file.</a>
- </audio>
17. VideoÖ§³Ö
ºÍAudioºÜÏñ£¬<video>±êÇ©ÌṩÁ˶ÔÓÚvideoµÄÖ§³Ö£¬ÓÉÓÚHTML5Îĵµ²¢Ã»ÓиøvideoÖ¸¶¨Ò»¸öÌض¨µÄ±àÂ룬ËùÒÔä¯ ÀÀÆ÷È¥¾ö¶¨ÒªÖ§³ÖÄÄЩ±àÂ룬µ¼ÖÂÁ˺ܶ಻һÖ¡£SafariºÍIEÖ§³ÖH.264±àÂëµÄ¸ñʽ£¬FirefoxºÍOperaÖ§³ÖTheoraºÍVorbis ±àÂëµÄ¸ñʽ£¬µ±Ê¹ÓÃHTML5 videoµÄʱºò£¬Äã±ØÐ붼Ìṩ£º
- <video controls preload>
- <source src=”cohagenPhoneCall.ogv” type=”video/ogg; codecs=’vorbis, theora’” />
- <source src=”cohagenPhoneCall.mp4″ type=”video/mp4; ’codecs=’avc1.42E01E, mp4a.40.2′” />
- <p> Your browser is old. <a href=”cohagenPhoneCall.mp4″>Download this video instead.</a> </p>
- </video>
18. Ô¤¼ÓÔØÊÓƵ
preloadÊôÐÔ¾ÍÏñËüµÄ×ÖÃæÒâ˼ÄÇô¼òµ¥£¬ÄãÐèÒª¾ö¶¨ÊÇ·ñÐèÒªÔÚÒ³Ãæ¼ÓÔصÄʱºòÈ¥Ô¤¼ÓÔØÊÓƵ
- <video preload>
19. ÏÔʾÊÓƵ¿ØÖÆ
- <video preload controls>
20. ÕýÔò±í´ïʽ
ÓÉÓÚpatternÊôÐÔ£¬ÎÒÃÇ¿ÉÒÔÔÚÄãµÄmarkupÀïÃæÖ±½ÓʹÓÃÕýÔò±í´ïʽÁË
- <form action=”" method=”post”>
- <label for=”username”>Create a Username: </label>
- <input type=”text” name=”username” id=”username” placeholder=”4 <> 10″ pattern=”[A-Za-z]{4,10}” autofocus required>
- <button type=”submit”>Go </button>
- </form>
21. ¼ì²âÊôÐÔÖ§³Ö
³ýÁËModernizrÖ®ÍâÎÒÃÇ»¹¿ÉÒÔͨ¹ýjavascript¼òµ¥µØ¼ì²âһЩÊôÐÔÊÇ·ñÖ§³Ö£¬È磺
- <script>
- if (!’pattern’ in document.createElement(’input’) ) {
- // do client/server side validation
- }
- </script>
22. MarkÔªËØ
°Ñ<mark>ÔªËØ¿´×öÊǸßÁÁµÄ×÷Ó㬵±ÎÒÑ¡ÔñÒ»¶ÎÎÄ×ÖµÄʱºò£¬javascript¶ÔÓÚHTMLµÄmarkupЧ¹ûÓ¦¸ÃÊÇÕâÑùµÄ£º
- <h3> Search Results </h3>
- <p> They were interrupted, just after Quato said, <mark>”Open your Mind”</mark>. </p>
23. ʲôʱºòÓÃ<div>
HTML5ÒѾÒýÈëÁËÕâô¶àÔªËØ£¬ÄÇôdivÎÒÃÇ»¹ÒªÓÃÂð£¿divÄã¿ÉÒÔÔÚûÓиüºÃµÄÔªËصÄʱºòÈ¥Óá£
24. ÏëÁ¢¼´Ê¹ÓÃHTML5?
²»ÒªµÈ2022ÁË£¬ÏÖÔھͿÉÒÔʹÓÃÁË£¬just do it.
25. ÄÄЩ²»ÊÇHTML5
1)SVG
2)CSS3
3)Geolocation
4)Client Storage
5)Web Sockets
26. DataÊôÐÔ
- <div id=”myDiv” data-custom-attr=”My Value”> Bla Bla </div>
CSSÖÐʹÓãº
- <style>
- h1:hover:after {
- content: attr(data-hover-response);
- color: black;
- position: absolute;
- left: 0;
- }
- </style>
- <h1 data-hover-response=”I Said Don’t Touch Me!”> Don’t Touch Me </h1>
27. OutputÔªËØ
<output>ÔªËØÓÃÀ´ÏÔʾ¼ÆËã½á¹û£¬Ò²ÓÐÒ»¸öºÍlabelÒ»ÑùµÄforÊôÐÔ
28. ÓÃRange InputÀ´´´½¨»¬¿é
HTML5ÒýÓõÄrangeÀàÐÍ¿ÉÒÔ´´½¨»¬¿é£¬Ëü½ÓÊÜmin, max, stepºÍvalueÊôÐÔ
¿ÉÒÔʹÓÃcssµÄ:beforeºÍ:afterÀ´ÏÔʾminºÍmaxµÄÖµ
- <input type=”range” name=”range” min=”0″ max=”10″ step=”1″ value=”">
- <style>
- input[type=range]:before { content: attr(min); padding-right: 5px;
- }
- input[type=range]:after { content: attr(max); padding-left: 5px;}
- </style>