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> in HTML5?We use <!DOCTYPE html>? at the first line of the page to let the browser know that we are using HTML5.
If it is missing then HTML5 tags won't work properly.
We use the header tags to create header in HTML5.
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.
Example:
<footer>
<!-- some code goes here -->
</footer>
In HTML4 the above code will look like the following.
<div id="footer">
<!-- some code goes here -->
</div>
We use the nav tags to create navigation bar in HTML5.
Example:
<nav>
<ul>
<li>Home</li>
<li>About</li>
<li>Contact</li>
</ul>
</nav>
In HTML4 the above code will look like the following.
<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.
Example:
<section>
<h1>This is the header</h1>
<p>The is a sample paragraph.</p>
</section>
In HTML4 the above code will look like the following.
<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.
Example:
<article>
<h1>This is the header of the post</h1>
<p>This is a sample paragraph of the post.</p>
</article>
In HTML4 the above code will look like the following.
<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.
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.
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>
ADVERTISEMENT