15+ HTML Interview Questions & Answers [2021 Edition]

15+ HTML Interview Questions & Answers [2021 Edition]

We have prepared a list of these top 15 HTML interview questions and answers to help you succeed in your interviews.

Subscribe to my newsletter and never miss my upcoming articles

Tim Berners Lee, the father of HTML, created HTML (HyperText Markup Language) in 1993. Since then, It has become one of the most widely used programming languages for creating web pages. Thus, HTML offers numerous job opportunities, as the demand for HTML is endless. So, if you are preparing for an HTML job, here are some of the most frequently asked HTML Interview Questions and Answers that will help you crack those tough job interviews.

It is highly recommended to learn HTML in web development.

First, let's start with basic ones, and then we will move our way to the advanced ones.

1. What is HTML

HTML or Hypertext Markup Language is a classic markup language used to create web pages for display on a web browser. HTML documents are saved with the .html and .htm extensions.

2. What is a Tag in HTML?

Tags are HTML codes used to place the content and format the pages in an HTML page. They always defined between (<) and (>) symbols. For example, < h1 > text < /h1 >.

3. Which HTML tags will you use to display HTML data in a table in tabular format

HTML has a specific tag, the table tag, that displays data in tabular form. Here is a list of the HTML tags used to display data in tabular form:

  • < table > For creating a table.

  • < caption > Adding a caption to the table.

  • < tr > To define a row in a table.

  • < td > To define a cell in a table.

  • < th > To create a table header cell.

  • < tbody > To group the content of the body in a table.

  • < col > To specify the column properties of each column of the table.

4. What are Attributes in HTML?

Each tag is given an additional attribute to modify its behavior. After the tag name, attributes are defined inside the angular brackets. They can only appear in opening tags and never in closing tags. For example:

You can define an attribute for the < input > tags, such as a text field, checkbox, radio button, or many more ways.

5. What are Lists in HTML?

The use of HTML lists is to group a set of related items in lists. You specify it with a li> tag. Lists commonly used in HTML include:

  • Ordered List (HTML tag: < ol >)
  • Unordered List (HTML tag: < ul >)
  • Description List (HTML tag: < dl >)
  • Menu List (HTML tag: < menu >)
  • Directory List (HTML tag: < dir >)

6. What advantages does HTML5 offer over its predecessors?


  • You can run Javascript in the background.
  • Includes new Semantic tags and form control tags.
  • Multimedia Support.
  • The ability to store offline data using SQL databases and application cache.
  • You can draw various shapes like rectangles, circles, triangles, etc

7. What is the difference between the < figure > tag and the < image > tag?

< figure > tags specify self-contained content, such as diagrams, images, code snippets, etc. It is used to semantically organize the contents of an image like image, image caption, etc., while the < img > tag is used to embed the picture in the HTML document.

8. What is the importance of and tag in HTML?

< head > tag offers the information about the document and should always be enclosed in the < HTML > tag. It contains the metadata about the webpage, and the tags which are enclosed by head tags like < link >, < meta>, < style >, < script >, etc. Also, there can only be one < head > tag in an HTML document, which will always appear before the < body > tag.

< body > tag defines the body of the HTML document and should always be enclosed in the tag. All the contents of the web page including images, text, audio, video, etc. will always be enclosed in the body tag, using elements such as < p >, < img >,< audio >, < heading >, div >, etc. Also, there can only be one < body > tag in an HTML document, which will always appear after the < head > tag.

9. What is Image Map?

Image Map lets a developer map/link different parts of images with the various web pages. The < map > tag in HTML allows us to link images with clickable areas.

<img  src=”image_url” ,  usemap=”#workspace” />

<map  name= workspace”>

      <area shape=”rect”  coords=”34, 44, 270, 350” ,  href=”xyz.html” />

      <area shape=”rect”  coords=”10, 120, 250, 360” ,  href=”xyz.html” />


10. What are Semantic Elements?

Semantic elements describe the particular meaning to the browser and the developer. < form >, < table >, < article >, < figure >, etc., are some examples of semantic elements.

11. How is Cell Padding differ from Cell Spacing?

The space between two consecutive cells is called Cell Spacing. At the same time, the space or gap between the text/ content of the cell and the edge/ border of the cell is called Cell Padding.

12. How many ways are there to position an HTML element?

The HTML position attribute has six main values, which can be used to position an HTML element:

  • static:
  • absolute:
  • Fixed:
  • relative
  • initial:
  • inherit:

13. What is the 'class' attribute in HTML?

The class attribute specifies the class name of an HTML element. Multiple HTML elements can have the same class value. Additionally, it is primarily used to associate styles written in the stylesheet with HTML elements.

Anchor tags < a > are used to enclose clickable hyperlinks to another webpage or section of the webpage. In contrast, link tags < link > denote a link between a document and external resources, not clickable.

15. What is HTML5?

HTML5 is the latest version of HTML released in 2014 by the World Wide Web Consortium. Currently, every employer wants to include this as one of the HTML interview questions.

It has outlined the following new characteristics for professionals to learn:

  • DOCTYPE declaration
  • Main
  • Section
  • Header
  • Footer
  • Article

HTML5 allows for easier web updates and changes, which helps generate more interactive and engaging content. So, it is highly recommended to learn HTML 5 in 2021.

If you have made it this far, then certainly you are willing to learn more. Here are some more topics related to interviewing questions that we think will be interesting for you.

Interested in reading more such articles from Yash Tiwari?

Support the author by donating an amount of your choice.

Recent sponsors
Share this