Top 10 HTML Basic Interview Questions and Answers - Study24x7
Social learning Network

Top 10 HTML Basic Interview Questions and Answers

Updated on 05 June 2022
study24x7
HTML and CSS
7 min read 7 views
Updated on 05 June 2022

HTML Versions


HTML 1.0: It was the first release but had very limited usage.

HTML 2.0: Released by adding some new features to HTML 1.0, this was the standard application for website development.

HTML 3.0: Due to improper standards of the existing version of HTML, popular browser developer Netscape Navigator had some of its own tags. This is when HTML 3.0 was introduced.

HTML 3.2: This version stopped the non-standardized HTML by introducing World Wide Web Consortium (in short W3C) to keep the language standardized.

HTML 4.0: Created an evolution as the browser support was undertaken by Microsoft in their Internet Explorer (IE).

HTML 5.0: The current version of HTML which was introduced especially to work with any type of devices like mobile, tablets, large monitors etc.


Difference between HTML4 and HTML5

Difference between HTML4 and HTML5


1. What is the need of mentioning <!DOCTYPE HTML> at the beginning of an HTML page?


The <!DOCTYPE HTML> indicates the version of HTML which in this case is 5. The earlier versions like HTML4 were based on Standard Generalized Markup Language (SGML) and required a Document Type Definition (DTD). HTML5 however, is not based on SGML and doesn’t need a DTD.


2. List out the new Structural Elements in HTML5.


HTML5 introduced few structural elements to define different parts of a web page like article, header, footer, main, mark and many more.

These are sections in which a web page is usually divided into. In HTML4, the same was implemented using div with an id/class name to it.


3. Define Meta tags.


Meta tags are the tags that provide more information to our web pages. Some of the tags that are examples for meta are:

  1. Link: Defines a relation between the web page and an external source.
  2. Style: Inserts styles (CSS) details to the web page.
  3. Title: Provides a title to the web page.


4. How is it possible to insert a copyright symbol in a web page?


As there is no direct key to type and insert the copyright symbol in a web page, it has to be given by combining different characters. This can be done in multiple ways like:

  1. &copy.
  2. & #169.


5. List the API’s available in HTML5.


The HTML5 standard introduced a number of new APIs. Here is a small list:

  1. Constraint Validation API
  2. Text Track API
  3. Media API
  4. Command API
  5. User Interaction
  6. Data Transfer API
  7. History API
  8. Application Cache API


6. Why Meta tags are used in HTML?


Answer: Meta tags in HTML are used by the developer to tell the browser about the page description, author of the template, character set, keywords and many more.

Meta tags are used for search engine optimization to tell the search engine about the page contents.

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale = 1.0">
<meta name="description" content="HTML interview questions">
<meta name="author" content="Author Name">
<meta name="copyright" content="All Rights Reserved">


7. Explain list elements in HTML.


Answer: Enlisted below are the list elements in HTML:

  1. Ordered List (<ol>) – An Ordered List or ol tag is the list that lists the items in an ordered way, i.e. numbered or alphabetically.
  2. Unordered List (<ul>) – An Unordered List or ul tag is the list which will list the items in an unordered way, i.e. in bulleted format or in any other format.
  3. Definition List (<dl>) – A Definition List or dl tag arrange the items in the way in which they are arranged in a dictionary.


8. How can we create a hyperlink in HTML?


Answer: An anchor tag or <a> tag in HTML is used to create hyperlinks. This creates a path between two different HTML web pages.


Hyperlinks can be displayed in three ways:

  1. Unvisited Link – These links are blue in color and underlined.
  2. Visited Link – These links are purple in color and underlined.
  3. Active Link – These links are red in color and underlined.


9. Why do we use the required attribute in HTML?


Answer: The required attribute is used in HTML to make the field mandatory. It forces the user to fill that particular field to submit the form.


If the field is input then it will throw a default HTML error.

<input type="email" name = "user_email" required />


10. Explain new form elements in HTML5.


Answer: The new form elements that were added into HTML5 are:

  1. Datalist – It’s used as a list of options for input control.
  2. Keygen – This tag defines a key-pair generator (Private/Public) field.
  3. Output – It’s used to show the result of a calculation.


study24x7
Write a comment...