HTML Interview Questions - Set 5

HTML Interview Questions

Share

This page contains HTML interview questions and answers.

Q1: What are the video formats supported by HTML5?

HTML5 supports the following video formats.

  • mp4
  • webm
  • ogg

Q2: What are the audio formats supported by HTML5?

HTML5 supports the following audio formats.

  • mp3
  • ogg
  • wav

Q3: What is the use of <!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.

Q4: How to create header in HTML5?

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>

Q5: How to create footer in HTML5?

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>

Q6: How to create menu bar or navigation bar in HTML5?

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>

Q7: How to create sections in HTML5?

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>

Q8: How to create articles in HTML5?

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>

Q9: Create a simple audio element in HTML5 page?

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>

Q10: Create a simple video element in HTML5 page?

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>
Share

Recently Updated