HTML Interview Questions
This page contains HTML interview questions and answers.
HTML5 supports the following video formats.
HTML5 supports the following audio formats.
<!DOCTYPE html>
We use <!DOCTYPE html>? at the first line of the page to let the browser know that we are using HTML5.
<!DOCTYPE html>?
If it is missing then HTML5 tags won't work properly.
We use the header tags to create header in HTML5.
header
Example:
<header> <!-- some code goes here --> </header>
In HTML4 the above code will look like the following.
<div id="header"> <!-- some code goes here --> </div>
We use the footer tags to create footer in HTML5.
footer
<footer> <!-- some code goes here --> </footer>
<div id="footer"> <!-- some code goes here --> </div>
We use the nav tags to create navigation bar in HTML5.
nav
<nav> <ul> <li>Home</li> <li>About</li> <li>Contact</li> </ul> </nav>
<div id="nav"> <ul> <li>Home</li> <li>About</li> <li>Contact</li> </ul> </div>
We use the section tags to create sections in HTML5.
section
<section> <h1>This is the header</h1> <p>The is a sample paragraph.</p> </section>
<div id="content"> <h1>This is the header</h1> <p>The is a sample paragraph.</p> </div>
We use the article tags to create articles to store blog posts, comments etc. in HTML5.
article
<article> <h1>This is the header of the post</h1> <p>This is a sample paragraph of the post.</p> </article>
<div id="post"> <h1>This is the header of the post</h1> <p>This is a sample paragraph of the post.</p> </div>
To create an audio element in HTML5 we have to use the audio tag and set the audio file path in the src attribute in the opening audio tag.
audio
src
In the following example we are creating an audio element.
<audio controls="controls" preload="none" src="/audio/alien-noise-01.mp3"> Your browser does not support the HTML audio tag. </audio>
To create a video element in HTML5 we have to use the video tag and set the video file path in the src attribute in the opening video tag.
video
In the following example we are creating a video element.
<video width="200" controls src="path/to/video-file.mp4"> Your browser does not support the HTML video tag. </video>