HTML5 Interview Questions

Question 1:

What do you know about HTML5?

HTML5 is the fifth version of the HTML5 standard, published on 28th October 2014 by W3C. HTML5 is a markupo language which is used for structuring and presenting contents on the web page.

Question 2:

List some of the new features introduced in HTML5.

The list of new features introduced by HTML5 is listed below:

  • Web Workers
  • Video
  • Canvas
  • Application caches
  • Geolocation
  • New HTML5 input elements like search, email, url, tel, number
Question 3:

What do you think whether HTML tags case-sensitive?

HTML tags are not case-sensitive which means that <div> tag is similar to <DIV> tag but it is good practice to use tags in lowercase.

Question 4:

What is DOCTYPE in HTML and what is the significance of DOCTYPE?

The <!DOCTYPE> declaration is very first thing that is declared on the html document. It is known as Document Type Definition. It is used to tell the web browsers what version of HTML is being used in HTML document and how browser is going to render it.

You can declare doctype for HTML5 version as shown below:

<!DOCTYPE html>

    Body Part

Question 5:

Which all HTML elements are not available in HTML5?

The list of old HTML elements which are deprecated in HTML5 and should not be used is listed below:

Element Description
<acronym> The HTML Acronym Element (<acronym>) allows authors to clearly indicate a sequence of characters that compose an acronym or abbreviation for a word.
<applet> The HTML Applet Element (<applet>) identifies the inclusion of a Java applet.
<basefont> The HTML basefont element (<basefont>) establishes a default font size for a document.
<big> The HTML Big Element (<big>) makes the text font size one size bigger.
<center> The entire content of this element is centered horizontally within its containing element.
 <dir>  The HTML directory element (<dir>) represents a directory, namely a collection of filenames.
 <font>  The HTML Font Element (<font>) defines the font size, color and face for its content.
 <frame>  <frame> is an HTML element which defines a particular area in which another HTML document can be displayed.
 <frameset>  <frameset> is an HTML element which is used to contain <frame> elements.
 <strike>  The HTML Strikethrough Element (<strike>) renders text with a strikethrough, or a line through it.
 <tt>  The HTML Teletype Text Element (<tt>) produces an inline element displayed in the browser's default monotype font.
<xmp> The HTML Example Element (<xmp>) renders text between the start and end tags without interpreting the HTML in between and using a monospaced font.


Question 6:

What is the difference between class and id in HTML?

class and id both are used as identifier/selector for any html element. 

For example:- 

<div id="myDiv" class="firstDiv"></div>

The basic difference between class and id is - 

  • id is unique whereas a same class can be applied to multiple elements on the html page. 
  • each element can have only one id whereas each element can have more than one class.


Question 7:

What is data dash attribute and how it is used?

Prior to HTML5,  there was few option to store data associated with DOM i.e. either in class attribute or rel attribute. Fortunately, HTML5 introduces custom data attributes. You can use any lowercase name prefixed with data- to create attribute and store any arbitrary data in it corresponding to any DOM.

For example:

<div id="listOfData" data-length="180" data-line-size="5" data-info="This is Demo Version"></div>

The best part about the data attribute is that we can also use it to provide JSON data as shown below:

<div id="listOfData" data-length="180" data-line-size="5" data-info='{"company":"Modern Pathshala"}'></div>
Question 8:

What are the new input types available in HTML5 forms?

HTML5 introduced list of new input types for forms which are listed below:

  • search
  • email
  • url
  • tel
  • number
  • range
  • date
  • month
  • week
  • time
  • datetime
  • datetime-local
  • color
Question 9:

What are the new attributes added in HTML5 for <input> tag?

HTML5 added list of new attributes for <input> tag which are listed below:

  • autocomplete
  • autofocus
  • form
  • formaction
  • formenctype
  • formmethod
  • formnovalidate
  • formtarget
  • height and width
  • list
  • min and max
  • multiple
  • pattern (regexp)
  • placeholder
  • required
  • step
Question 10:

What is the use of "required" attribute in HTML5?

HTML5 introduced a new attribute for <input> tag i.e "required" which is a boolean attribute and specifies that the input type must be filled with some data for the form to be submitted. In other words, to submit a form, the input type with required attribute should have some data and cannot be blank.


<input type="name" required>

Share interview questions


comments powered by Disqus


Social Media