欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長(zhǎng)資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          詳解H5非常重要的28個(gè)新特性,新技巧和新技術(shù)

          HTML5有很多的新功能.新代碼.非常不錯(cuò).現(xiàn)在總結(jié)一下.僅供參考1. 新的Doctype
          盡管使用<!DOCTYPE html>,即使瀏覽器不懂這句話也會(huì)按照標(biāo)準(zhǔn)模式去渲染
          2. Figure元素
          用<figure>和<figcaption>來(lái)語(yǔ)義化地表示帶標(biāo)題的圖片
          <figure>
          <img src=”path/to/image” alt=”About image” />
          <figcaption>
          <p>This is an image of something interesting. </p>
          </figcaption>
          </figure>
          3. 重新定義的<small>
          <small>已經(jīng)被重新定義了,現(xiàn)在被用來(lái)表示小的排版,如網(wǎng)站底部的版權(quán)聲明
          4. 去掉link和script標(biāo)簽里面的type屬性
          5. 加/不加 括號(hào)
          HTML5沒(méi)有嚴(yán)格的要求屬性必須加引號(hào),閉合不閉合,但是建議加上引號(hào)和閉合標(biāo)簽
          6. 讓你的內(nèi)容可編輯,只需要加一個(gè)contenteditable屬性
          7. Email Inputs
          如果我們給Input的type設(shè)置為email,瀏覽器就會(huì)驗(yàn)證這個(gè)輸入是否是email類(lèi)型,當(dāng)然不能只依賴(lài)前端的校驗(yàn),后端也得有相應(yīng)的校驗(yàn)
          8. Placeholders
          這個(gè)input屬性的意義就是不必通過(guò)javascript來(lái)做placeholder的效果了
          9. Local Storage
          使用Local Storage可以永久存儲(chǔ)大的數(shù)據(jù)片段在客戶(hù)端(除非主動(dòng)刪除),目前大部分瀏覽器已經(jīng)支持,在使用之前可以檢測(cè)一下window.localStorage是否存在
          10. 語(yǔ)義化的header和footer
          11. 更多的HTML5表單特性
          12. IE和HTML5
          默認(rèn)的,HTML5新元素被以inline的方式渲染,不過(guò)可以通過(guò)下面這種方式讓
          其以block方式渲染
          header, footer, article, section, nav, menu, hgroup {
          display: block;
          }
          不幸的是IE會(huì)忽略這些樣式,可以像下面這樣fix:
          document.createElement(”article”);
          document.createElement(”footer”);
          document.createElement(”header”);
          document.createElement(”hgroup”);
          document.createElement(”nav”);
          document.createElement(”menu”);
          13. hgroup
          一般在header里面用來(lái)將一組標(biāo)題組合在一起,如

          <header>   <hgroup>   <h1> Recall Fan Page </h1>   <h2> Only for people who want the memory of a lifetime. </h2>   </hgroup>   </header>

          14. Required屬性
          required屬性定義了一個(gè)input是否是必須的,你可以像下面這樣聲明
          <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>標(biāo)簽,你不需要再按照第三方插件來(lái)渲染音頻,大多數(shù)現(xiàn)代瀏覽器提供了對(duì)于HTML5 Audio的支持,不過(guò)目前仍舊需要提供一些兼容處理,如

          <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>標(biāo)簽提供了對(duì)于video的支持,由于HTML5文檔并沒(méi)有給video指定一個(gè)特定的編碼,所以瀏 覽器去決定要支持哪些編碼,導(dǎo)致了很多不一致。Safari和IE支持H.264編碼的格式,F(xiàn)irefox和Opera支持Theora和Vorbis 編碼的格式,當(dāng)使用HTML5 video的時(shí)候,你必須都提供:

          <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. 預(yù)加載視頻
          preload屬性就像它的字面意思那么簡(jiǎn)單,你需要決定是否需要在頁(yè)面加載的時(shí)候去預(yù)加載視頻
          <video preload>
          19. 顯示視頻控制
          <video preload controls>
          20. 正則表達(dá)式
          由于pattern屬性,我們可以在你的markup里面直接使用正則表達(dá)式了

          <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. 檢測(cè)屬性支持
          除了Modernizr之外我們還可以通過(guò)javascript簡(jiǎn)單地檢測(cè)一些屬性是否支持,如:

          <script>   if (!’pattern’ in document.createElement(’input’) ) {   // do client/server side validation   }   </script>

          22. Mark元素
          把<mark>元素看做是高亮的作用,當(dāng)我選擇一段文字的時(shí)候,javascript對(duì)于HTML的markup效果應(yīng)該是這樣的:
          <h3> Search Results </h3>
          <p> They were interrupted, just after Quato said, <mark>”O(jiān)pen your Mind”</mark>. </p>
          23. 什么時(shí)候用<p>
          HTML5已經(jīng)引入了這么多元素,那么p我們還要用嗎?p你可以在沒(méi)有更好的元素的時(shí)候去用。
          24. 想立即使用HTML5?
          不要等2022了,現(xiàn)在就可以使用了,just do it.
          25. 哪些不是HTML5
          1)SVG
          2)CSS3
          3)Geolocation
          4)Client Storage
          5)Web Sockets
          26. Data屬性

          <p id=”myp” data-custom-attr=”My Value”> Bla Bla </p>   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>元素用來(lái)顯示計(jì)算結(jié)果,也有一個(gè)和label一樣的for屬性
          28. 用Range Input來(lái)創(chuàng)建滑塊
          HTML5引用的range類(lèi)型可以創(chuàng)建滑塊,它接受min, max, step和value屬性
          可以使用css的:before和:after來(lái)顯示min和max的值

          <input type=”range” name=”range” min=”0″ max=”10″ step=”1″ value=”">   input[type=range]:before { content: attr(min); padding-right: 5px;   }   input[type=range]:after { content: attr(max); padding-left: 5px;}

          贊(0)
          分享到: 更多 (0)
          網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)