52 Most important HTML interview questions

In this tutorial we will learn all important html interview questions and also learn html5 interview questions with answers.

html interview questions

1) What is HTML? | What Does HTML stand for?

HTML is a hypertext markup language for creating web pages.

html interview questions

2) What is HTML tags?

Html tags are used to mark up the start/opening and end/closing tags.

Tags are two types-

Example - <p> This is opening tag.

                    </p> This is closing tag.

3) What is HTML elements?

An HTML element usually consists of  a starting tag & end tag.

Example - <p> This is the content of the paragraph element </p> .

4) What is HTML attributes?

Attributes provide additional information about an element and attributes are always specified in the start tag.

All attributes have of two parts -

Example -

<a href="https://www.teknowize.com" target="_blank" title="click here">

5) Is all HTML tag have an end tag ?

No,some HTML tag not need a closing tag.

For example -

<image> tag , <br> tag ,<hr> tag etc.

6) Formatting in HTML is what?

It is a process in which the text is formating for a better look. It use many type of tags for making text bold, italic, underline etc.

7) How many type of heading tag in HTML?

The HTML has six types of heading tag. The H1 tag is the largest heading tag and the H6 is the smallest heading tag.

html interview questions

8) How to create a hyperlink in HTML?

HTML have a tag which is called as ancor tag , which use to create a hyperlink that link one webpage to another webpage.

The ancor tag appear in three ways -

Unvisited link

Visited link

Active link

9) HTML tags which display data in tabular form?

In HTML, the table tag displays the data in tabular form ( row * column ).Layout for the page e.g., header section, navigation bar, body content, footer section also managed by table tag.

List of tags used when displaying the data in tabular form -

<table> It defines a table.
<tr> It define a row in a table.
<th> It define a header cell in a table.
<td> It defines a cell in a table.
<caption> It define the table caption.
<colgroup> It specified a group of one or more columns in a table for formatting.
<col> It is use with <colgroup> element to specify column properties for each column.
<tbody> It is use to group the body content in a table.
<thead> It is used to group the header content in a table.
<tfooter> It is used to group the footer content in a table.

10) Explain all type of list which used when designing a webpage?

There are many types of list are available but two types of list are  commonly use 

11) How copyright symbol can be inserted into a browser page?

Copyright symbol can be inserted into a browser page using &copy; or &#169; in an HTML file.

12) How nested webpage can create in HTML?

Iframe tag is used to create a nested webpage in HTML. In another word, iframe is used to create a webpage within a webpage.

For example -

html interview questions

13) How to keep HTML list elements straight?

Indents are used to keep HTML element straight.

14) Where can you apply hyperlink?

We can apply hyperlink in text and images both. In HTML ancor tag use to link one page with another page.

html interview questions

15) Style sheet is what?

Style sheet is use to make web pages creative. We use cascading style sheet to designing the web pages.

16) Creating multi-colored text on a web page is possible?

Yes it is possible to use multi-colored text on a webpage.

17) Can we change the color of the bullet?

The color of the bullet depend on the first text color of the list.

18) Describe the layout of the HTML?

Actually, web pages arrange in which manner, that is described in HTML layout.

<header> : It is used to create head of the website.

<nav> : It is used to create navigation bar of the website.

<section> : It is used to create section in a website.

<article> : Using it we can create an independent, self-contained article.

<aside> : Using it we can create content aside from the content ( just like sidebar ).

<footer> : It is used to create footer of the website.

html interview questions

19) which tag we can use to separate a section of texts?

<br> tag - The <br> tag is used to break the line the text.

<p> tag - <p> tag stand for paragraph tag which means, the text written in the form of new paragraph.

20) How to put background image in a web page?

We can put the background image in a webpage by using below code after </head> tag.

html interview questions

21) Empty element is what in HTML?

The element with no content are known as empty element.

For example - <br> , <hr> etc.

22) Explain the use of span tag in HTML?

Span tag in HTML is used for -

• To add colour on text.

• To add background on the text.

• To highlight any text.

Example - 

html interview questions

23) Explain the use of iframe tag in HTML?

Iframe tag in HTML used to display a web page inside a web page.

Syntax - 

<iframe src="URL"> </iframe>

For example -

html interview questions

HTML5 Interview Questions

Lets learn most important Html5 interview questions.

24) Is <! DOCTYPE html> tag is HTML tag?

No, <!DOCTYPE html> tag is not a HTML tag. It is basically used to give instruction to the web browser about the version of the HTML page.

25) Explain canvas element in HTML5?

The <canvas> element is a container using which we can draw  graphic on web page with the help of scripting language (like JavaScript ).

Example -

html interview questions

26) Explain SVG ?

Using HTML SVG we can describe  two dimensional vector and vector graphics / raster graphics.

Example -

html interview questions

27) What new form elements are introduced in HTML5?

• Color

• Date

• Datetime-local

• Email

• Time

• Url

• Range

• Telephone

• Number

• Search

28) Is every web browsers support?

Yes, almost every web browser support HTML5 

Example - Chrome, opera, Firefox, Internet explorer, Safari etc.

29) HTML5 support which type of video?

• MP4

• WebM

• Ogg

30) HTML5 support which type of audio tag?

• mp3


• Ogg

Now see the code, using which mp3 file can be played in HTML.

html interview questions

31) Define figure tag in HTML5?

On the web page, we can add photo in the document using figure tag.

html interview questions

32) Define figcaption tag in HTML5?

Using <figcaption> element we can provide a caption to an image. It is optional tag which always used before or after the content in <figure> tag.

html interview questions

33) Button tag is what in HTML5?

In HTML5, <button> tag is used to create a clickable button set the <form> tag.

html interview questions

34) what is datalist tag in HTML5?

Datalist tag used to provide facility to the user to choose the predefined option to select data.

html interview questions

35) Show all the tags which migrate from HTML for HTML5.

<div id="header"> <header>
<div id="menu"> <nav>
<div id="content"> <section>
<div id="post"> <article>
<div id="footer"> <footer>

36) If we do not put <! DOCTYPE html> then HTML5 work or not?

No, because if we do not put <! DOCTYPE html>  then browser unable to identify the HTML document , due to which some HTML5 tag are not function properly.

37) Why 'required' attribute use in HTML5?

The required attribute is used in HTML5 for force the user to fill text in the text field before submitting the form.

html interview questions

38) Which <input> type are added in HTML5 for form validation?

The input type added in HTML5 for validation is email, url, number, tel and date.

html interview questions

39) How to add HTML auto-complete with one line of code?

You can add HTML autocomplete with the below code.

html interview questions

40) How can page loading time be reduced?

There are many factors which affect the speed of page loading of a website.

Some methods which help to increase page speed are -

• Reduce the size of the image.

• Remove all unnecessary CSS JS file.

• HTTP compression.

• Minimal caching.

• Minimal redirection.

41) If there is no text between text then what happens?

If text does not presents between tags then there is nothing happened but tag which has no closing tag like <image>, <br> then they not required any text.

42) Limit of the text field size are?

The default limit of the text field size are 13 character but if you include attribute of size then you can set the size.

43) Cellspacing and cellpadding is what?

Cell spacing is used to provide a gap or space between each cell. Where cell padding is used to provide a gap or space between text written inside the cell.

44) Difference between HTML and XHTML is what?

html interview questions

45) CSS can be included in HTML in which way?

In HTML there are three ways in which we can include CSS -

• Inline CSS

html interview questions

• External CSS

html interview questions

• Internal CSS

html interview questions

46) JavaScript can be included in web page in which way? 

In webpage, we can include JavaScript in three way -

• Inline

html interview questions

• Script block

html interview questions

• Link to JavaScript file

html interview questions

47) Explain marquee?

Marquee is used to add auto scrollable text/image on your webpage.

Syntax - 

html interview questions

48) Viewport and how to set it up?

Visible area of a webpage on a browser

changes based on the device size.

syntax -

html interview questions

49) How to change text color in HTML?

You can change text color in HTML by HTML style attribute.

Syntax -

<tagname style="property:value;">

How to change text color in HTML

50) How to bold text in HTML?

You can bold text in HTML by using bold tag or strong tag.

Syntax -

<b> </b> 


<strong> </strong>

How to bold text in HTML

51) How to centre text in HTML?

You can move any text into center using HTML center tag.

Syntax -

<center> </center>

How to centre text in HTML

51) How to comment in HTML?

You can comment HTML source by below syntax

Syntax -

<!-- write your comment here  -->

How to comment in HTML

52) How to link CSS to HTML?

You can link CSS to HTML using link tag. The link tag always placed inside head tag.

Syntax -

<link rel="stylesheet" type="text/css" href=" file path of your .css file " >

How to link CSS to HTML