10 Common HTML5 Interview Questions and Answers

1. What are the new HTML5 document types and character sets?

  HTML5 document type:

  

<!doctype html>

 

 

  HTML5 uses UTF-8 encoding demo:

  

<meta charset="UTF-8">

 

 

2. How to embed audio in HTML5?

  HTML5 supports audio in mp3, Wav and Ogg formats. Here is a simple example of embedding audio in a web page:

  

<audio controls>
  <source src="jamshed.mp3" type="audio/mpeg">
  your browser does'nt support audio embedding feature.
</audio>

 

 

3. How to embed video in HTML5?

Similar to audio, HTML5 supports video in MP4, Wav and Ogg formats. Here is a simple example:

 

<video width="450" height="340" controls>
    <source src="jamshed.mp4" type="video/mp4">
    your browser dose'nt support void embedding feature.
</video>

 

 

4. Besides audio and video, what other media tags are there in HTML5?

  HTML5 provides strong support for multimedia. In addition to audio and video tags, it also supports the following tags:

  The <embed> tag defines embedded content, such as plugins.

<embed type="video/quicktime" src="Fishing.mov">

   The <source> tag is useful for defining multiple data sources.

<video width="450" height="340" controls>
    <source src="jamshed.mp4" type="video/mp4">
    <source src="jamshed.ogg" type="video/ogg">
</video>

   The <track> tag specifies an outer text track for media such as video elements. Used to specify subtitle files or other files containing text that are visible when the medium is playing.

<video width="450" height="340" controls>
    <source src="jamshed.mp4" type="video/mp4">
    <source src="jamshed.ogg" type="video/ogg">
    <track kind="subtitles" label="English" src="jamshed.mp4">
    <track kind="subtitles" label="Arabic" src="jamshed.ogg">
</video>

 

5. What is the use of the HTML5 Canvas element?

  The Canvas element is used to draw graphics on web pages. The power of this element tag is to perform graphics operations directly on HTML

<canvas id="convasl" width="300" height="100">

</canvas>

 

6. What is the difference between HTML5 storage types?

  HTML5 can store data locally. Cookies were used in the past. HTML5 provides the following two local storage solutions:

  --localStorage is used for persistent local storage, data will never expire and will not be lost when closing the browser.

  --sessionStorage同一个会话中的页面才能访问并且当会话结束后数据也随之销毁。因此sessionStorage不   是一种持久化的本地存储,仅仅是会话级别的存储。

 

7.HTML5有哪些新增的表单元素?

  HTML5新增了很多表单元素让开发者构建更优秀的Web应用程序。

datalist

datetime

output

keygen

date

month

week

time

color

number

range

email

url

 

8.HTML5废弃了哪些HTML4标签?

frame

frameset

noframe

applet

big

center

basefront

 

9.HTML5标准提供了哪些新的API?

  HTML5提供了应用程序API主要有:

Media API

Text Track API

Application Cache API

User Interaction

Data Transfer API

Command API

Constraint Validation API

History API

 

10.HTML5应用程序缓存和浏览器缓存有什么区别?

  应用程序缓存是HTML5的重要特性之一,提供了离线使用的功能,让应用程序可以获取本地的网站内容,     例如HTML、CSS、图片以及JavaScript。这个特性可以提高网站性能,它的实现借助于manifest文件,如     下:

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

  ...

</html>

 

  与传统浏览器缓存相比,它不强制用户访问的网站内容被缓存。

 

(文章来自:http://t.cn/Rz4y77t)

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327030921&siteId=291194637