[HTML面試]HTML5 面試中最常問到的 10 個問題

來源:互聯網
上載者:User

標籤:c   java   a   http   tar   ext   

1. HTML5 新的 DocType 和 Charset 是什嗎?
HTML5 現在已經不是 SGML 的子集,DocType 簡化為:
                  <!doctype html>
HTML 5 指定 UTF-8 編碼的方式如下:
                 <meta charset="UTF-8">

2. 如何在 HTML5 頁面中嵌入音頻?
HTML 5 包含嵌入音頻檔案的標準方式,支援的格式包括 MP3、Wav 和 Ogg:
<audio controls>
    <source src="jamshed.mp3" type="audio/mpeg">
    Your browser does‘nt support audio embedding feature.
</audio>

3. 如何在 HTML5 頁面中嵌入視頻?
和音頻一樣,HTML5 定義了嵌入視頻的標準方法,支援的格式包括:MP4、WebM 和 Ogg:

<video width="450" height="340" controls>
  <source src="jamshed.mp4" type="video/mp4">
   Your browser does‘nt support video embedding feature.
</video>

4.除了音頻和視頻,HTML5 還支援其他什麼新的媒體元素?

HTML 5 對媒體支援很強,除了 audio 和 video 外,還提供:

  • <embed> 作為外部應用的容器
  • <track> 定義媒體的文本跟蹤
  • <source> 對多種媒體源的支援很有協助


5.What is the usage of canvas Element in HTML 5?
<canvas> is an element in HTML5 which we can use to draw graphics with the help of scripting (which is most probably JavaScript).
This element behaves like a container for graphics and rest of things will be done by scripting. We can draw images, graphs and a bit of animations etc using <canvas> element.

<canvas id="canvas1" width="300" height="100">
</canvas>

6. HTML5 有哪些不同類型的儲存?

HTML 5 支援本機存放區,在之前版本中是通過 Cookie 實現的。HTML5 本機存放區速度快而且安全。

有兩種不同的對象可用來儲存資料:

  • localStorage 適用於長期儲存資料,瀏覽器關閉後資料不丟失
  • sessionStorage 儲存的資料在瀏覽器關閉後自動刪除


7. HTML5 引入什麼新的表單屬性?

HTML5 引入大量新的表達屬性:

  • datalist
  • datetime
  • output
  • keygen
  • date
  • month
  • week
  • time
  • number
  • range
  • email
  • url


8. 與 HTML4 比較,HTML5 廢棄了哪些元素?

廢棄的元素包括:

  • frame
  • frameset
  • noframe
  • applet
  • big
  • center
  • basefront


9. HTML5 標準提供了哪些新的 API?

HTML 5 提供很多新的 API,包括:

  • Media API
  • Text Track API
  • Application Cache API
  • User Interaction
  • Data Transfer API
  • Command API
  • Constraint Validation API
  • History API
  • and many more....


10. HTML5 應用緩衝和常規的 HTML 瀏覽器緩衝有何差別?

       HTML5 的應用緩衝最關鍵的就是支援離線應用,可擷取少數或者全部網站內容,包括 HTML、CSS、映像和 JavaScript 指令碼並存在本地。該特性加速了網站的效能,可通過如下方式實現:

<!doctype html>
<html manifest="example.appcache">
.....
</html>

與傳統的瀏覽器緩衝比較,該特性並不強制要求使用者訪問網站。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.