HTML5 Interview Questions Part 3

11. Which are the media elements use in HTML5?

Answer:

Following are the five most popular media elements used in HTML5,

  • Audio
  • Video
  • Track
  • Source
  • Embed
Audio: The <audio> tag defines music or any other audio stream formats.

Video: The <video> tag is used to embed a video file an HTML or XHTML document.

Track: Track defines text tracks for <audio> and <video>.

Source: The <source> tag defines the multiple media resources for <video> and <audio>.

Embed: Embed provides a container for an external application or interactive content. Embed is also called as containers and it is used for defining the containers for the external applications.

12. What is the purpose of cite tag in HTML5?

Answer:

A <cite> tag indicates a citation that represents the title of a work, for eg. a book, a paper, an essay, a poem, a score, a song, a script, a film, a TV show, a game, a sculpture, a painting, a theater production, a play, an opera, a musical, an exhibition, etc.

Syntax:
A great Tutorial on <cite>HTML5</cite>

13. What is the use of Microdata in HTML5?

Answer:

Microdata allows you to define your own customized elements and start embedding custom properties in our web pages.

It provides a standardized syntax for additional semantic markup to your web pages to enhance the machine readability of your web pages.

It allows machine-readable data to be embedded in HTML documents.

It defines five HTML attributes that can be applied to any HTML5 as follows,

1. Itemscope – It indicates the element is a microdata element and its child elements are part of its microdata format.

2. Itemtype – It defines the vocabulary to be used by the microdata format.

3. Itemid – It is a unique identifier of the item, if defined by the microdata vocabulary.

4. Itemprop – It is an individual data element.

5. Itemref – It allows a microdata element to reference another element on the page to define it by either HTML id or by itemid.

Example:

<html>
   <body>
      <div itemscope>
         <p>Welcome to <span itemprop="name">CareerRide</span>.</p>
      </div>
   </body>
</html>


In the above example, 'itemscope' attribute is used to create an item and 'itemprop' attribute is used to add property to an item

14. What is the use of <details> tag in HTML5?

Answer:

The <details> tag is a new tag in HTML5 that specifies additional information or controls about the documents that the user can view or hide on demand.

This tag can also be used along with the <summary> tag to make your own header so that the user can expand or collapse the details of the document when required.

The <details> tag is only supported by Chrome.

Example:

<!DOCTYPE html>
<html>
   <body>
      <details>
         <summary>CareerRide.com</summary>
         <p>© Copyright 2016.</p>
         <p>All Rights Reserved.</p>
      </details>
   </body>
</html>


details tag
details tag

15. What is the use of <figure> tag in HTML 5?

Answer:

The <figure> tag represents a piece of self-contained flow content like photos, diagrams etc., typically referenced as a single unit from the main flow of the document.

Example:

<!DOCTYPE html>
<html>
<head>
    <title>Example of HTML <figure> Tag</title>
</head>
<body>
    <figure>
        <img src="/home/careerride2/Downloads/locky.jpeg" alt="locky" width="304" height="228">
        <figcaption>Locky is a ransomware malware</figcaption>
    </figure>
</body>
</html>


figure tag