10 most common HTML5 Interview Questions and Answers, html5 Questions and answers
1. What is the new HTML5 document type and character set?
HTML5 document type is simple:
<!doctype html>
2. How to embed audio in HTML5?
HTML5 supports audio in MP3, Wav, and Ogg formats. The following is a simple example of embedding audio in a webpage:
<audio controls> <source src=”test.mp3″ type=”audio/mpeg”> Your browser does’nt support audio embedding feature.</audio>
3. How to embed videos in HTML5?
Similar to audio, HTML5 supports MP4, WebM, and Ogg videos. The following is a simple example:
<video width=”450″ height=”340″ controls> <source src=”t.mp4″ type=”video/mp4″> Your browser does’nt support video embedding feature.</video>
The following points must be emphasized: controls = "true", controls = "controls" is incorrect in html5.
You can write multiple data sources as follows:
<video width=”450″ height=”340″ controls> <source src=”t.mp4″ type=”video/mp4″> <source src=”t.ogg” type=”video/ogg”></video>
Specify subtitle files or other files containing text for the video Element
<video width=”450″ height=”340″ controls> <source src=”t.mp4″ type=”video/mp4″> <source src=”t.ogg” type=”video/ogg”> <track kind=”subtitles” label=”English” src=”t_en.vtt” srclang=”en” default></track> <track kind=”subtitles” label=”Arabic” src=”t_ar.vtt” srclang=”ar”></track></video>
4. In addition to audio and video, what media tags does HTML5 have?
HTML5 provides strong support for multimedia. In addition to audio and video tags, it also supports the following tags:
<Embed> labels define embedded content, such as plug-ins.
<embed type=”video/quicktime” src=”test.mov”>
5. What is the use of HTML5 Canvas elements?
The Canvas element is used to draw a graph on a webpage. The element tag is powerful in that it can be used for graphic operations directly on HTML.
<canvas id=”canvas1″ width=”300″ height=”100″></canvas>
...