Download as pdf or txt
Download as pdf or txt
You are on page 1of 59

8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

(/) Scaler Academy Practice Contests Mock Interview Blog Sign in

(/academy/) (/practice/) (/contests/) (/mock- (/blog/)


interview/)

HTML Interview Questions


and Answers

1. Are the HTML tags and


elements the same thing?

2. What are tags and attributes in


HTML?

3. What are void elements in


HTML?

4. What is the advantage of


collapsing white space?
×

Free Mock Coding Interview
Looking to 5. What
crack areInterviews?
SDE HTML Entities?
Get a personalised Learning
Preparing for tech Plan

for FREE!
6. What are different types of lists
interviews?
in HTML?
Attempt Now!
(https://www.scaler.com/event/mock-coding-interview/?utm_source=ib&utm_medium=top_nudge&utm_campaign=MoCo&utm_content=/html-
Learn from the best

interview-questions//)
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
15000+ Developers Registered!
HTML?for FREE
Try Academy

8. What is the difference between
(https://www.fac
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
 app_id=3141584
attribute of HTML elements?
(https://www linkedin
https://www.interviewbit.com/html-interview-questions/ 1/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit
(https://www.linkedin
interview-
mini=true&url=https
questions/&quo
interview-
and

questions/&title=Top
Practice
(https://twitt
HTMLon
status=Top
HTML Interview Questions and almost
and Answers HTML5all HTML
Interview
coding
and
1. Are the HTML tags and Share with:
Questions
interview
HTML5
HTML Interview
elements Questions
the same thing? Download PDF (2021)
questions 
Interview
- askedQuestions
2. What are tags and attributes in InterviewBit&summa
historically
(2021)
HTML? HTMLand -
and get InterviewBit&
3. What are void elements in HTML5
referred
interview-
HTML? Interview
to questions/&
Questions
the
4. What is the advantage of
(2021)
best
collapsing white space?
× - tech
InterviewBit&source
companies&disp
5. What are HTML Entities?
interview-
Preparing for tech

6. What are different types of lists questions/)


interviews?
in HTML?
Learn from the best
This article covers the most frequently asked HTML (https://www.interviewbit.com/html-
instructors in the field.
7. What is the ‘class’ attribute in
interview-questions/#html) and HTML5 (https://www.interviewbit.com/html-interview-
HTML?for FREE
Try Academy questions/#html5) questions asked in interviews.

8. What is the difference between


Introduction:
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 2/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

Before starting with the interview questions on HTML Language, let’s first go through HTML,
what is HTML, the career opportunities it provides, etc.

HTML stands for HyperText Markup language. It is a standard text formatting language used for
developing web pages released in 1993. HTML is a language that is interpreted by the browser
HTML Interview Questionsand it tells the browser what to display and how to display.
and Answers
HTML is an important language to learn if anyone wants to work in the web development
domain [Web designers, Web Developers]. HTML alone is not sufficient for a web developer
1. Are the HTML tags and
because HTML only defines the structure of the data that will be rendered on the browser in a
elements the same thing?
webpage, to make it visually appealing and to make it functional, we will need to use CSS
2. What are tags and attributes(https://www.interviewbit.com/css-interview-questions/)
in and Javascript
HTML? (https://www.interviewbit.com/javascript-interview-questions/) respectively.

3. What are void elements in The latest version of HTML is HTML5. There are two main components in HTML language, Tags
HTML? and Attributes. The below image shows some basic HTML tags and attributes.

4. What is the advantage of


collapsing white space?
×

5. What are HTML Entities?


Preparing for tech

6. What are different types of lists


interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Crack your next
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements? tech interview with
https://www.interviewbit.com/html-interview-questions/ 3/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

confidence! Take Free Mock Interview


Take a free mock (https://www.scaler.com/event/mock-coding-interview/?

interview, get utm_source=ib&utm_medium=in-interview-


instant⚡️feedback guide&utm_campaign=MoCo&utm_content=/html-interview-
and recommendation questions/)
HTML Interview Questions
💡
and Answers

1. Are the HTML tags and


elements the same thing?

2. What are tags and attributes in


HTML Interview Questions and Answers
HTML? 1. Are the HTML tags and elements the same thing?
3. What are void elements in No. HTML elements are defined by a starting tag, may contain some content and a closing
HTML? tag.For example, <h1>Heading 1</h1> is a HTML element but just <h1> is a starting tag and
</h1> is a closing tag.
4. What is the advantage of
collapsing white space?
× 2. What are tags and attributes in HTML?

5. What are HTML Entities? Tags are the primary component of the HTML that defines how the content will be structured/
Preparing for tech
formatted, whereas Attributes are used along with the HTML tags to define the characteristics
of the element. For example, <p align=” center”>Interview questions</p>, in this the ‘align’ is
6. What are different types of lists
interviews?
in HTML? the attribute using which we will align the paragraph to show in the center of the view.
Learn from the best

instructors
7. Whatinisthe
thefield. 3.
‘class’ attribute in What are void elements in HTML?
HTML?for FREE
Try Academy
HTML elements which do not have closing tags or do not need to be closed are Void elements.
8. What is the difference between For Example <br />, <img />, <hr />, etc.
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 4/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

 You can download a PDF version of Html Interview


Download
Questions.
PDF

4. What is the advantage of collapsing white space?


HTML Interview Questions
In HTML, a blank sequence of whitespace characters is treated as a single space character,
and Answers
Because the browser collapses multiple spaces into a single space character and this helps a
1. Are the HTML tags and developer to indent lines of text without worrying about multiple spaces and maintain
elements the same thing? readability and understandability of HTML codes.

2. What are tags and attributes5.


in What are HTML Entities?
HTML?
In HTML some characters are reserved like ‘<’, ‘>’, ‘/’, etc. To use these characters in our
webpage we need to use the character entities called HTML Entities. Below are a few mapping
3. What are void elements in
between the reserved character and its respective entity character to be used.
HTML?

4. What is the advantage of Character Entity Name Entity Number


collapsing white space?
× < &lt; &#60;
5. What are HTML Entities?
> &gt; &#62;
Preparing for tech

6. What are different types of lists& &amp; &#38;


interviews?
in HTML?
Learn from the best
(non-breaking space) Eg. &nbsp; Eg. &#160;
instructors
7. Whatinisthe
thefield.
‘class’ attribute in 10  PM <p>10&nbsp&nbspPM</p>
HTML?for FREE
Try Academy

8. What is the difference between


6. What are different types of lists in HTML?
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 5/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

HTML Interview Questions


and Answers

1. Are the HTML tags and


elements the same thing?

2. What are tags and attributes7.


in What is the ‘class’ attribute in HTML?
HTML?
The class attribute is used to specify the class name for an HTML element. Multiple elements in
3. What are void elements in HTML can have the same class value. Also, it is mainly used to associate the styles written in the
HTML? stylesheet with the HTML elements.

4. What is the advantage of 8. What is the difference between the ‘id’ attribute and the ‘class’ attribute
collapsing white space?
× of HTML elements?
5. What are HTML Entities? Multiple elements in HTML can have the same class value, whereas a value of id attribute of one
Preparing for tech
element cannot be associated with another HTML element.
6. What are different types of lists
interviews?
in HTML? 9. Define multipart form data?
Learn from the best

instructors
7. Whatinisthe
thefield. Multipart form data is one of the values of the enctype attribute. It is used to send the file data
‘class’ attribute in
HTML?for FREE
Try Academy to the server-side for processing. The other valid values of the enctype attribute are text/plain
and application/x-www-form-urlencoded.
8. What is the difference between
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
10.
the ‘id’ attribute and the ‘class’ Describe HTML layout structure.
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 6/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

Every web page has different components to display the intended content and a specific UI. But
still, there are few things which are templated and are globally accepted way to structure the
web page, such as:

<header>: Stores the starting information about the web page.


HTML Interview Questions <footer>: Represents the last section of the page.
and Answers <nav>: The navigation menu of the HTML page.
<article>: It is a set of information.
1. Are the HTML tags and
<section>: It is used inside the article block to define the basic structure of a page.
elements the same thing?
<aside>: Sidebar content of the page.
2. What are tags and attributes in
HTML? 11. How to optimize website assets loading?
To optimize website load time we need to optimize its asset loading and for that:
3. What are void elements in
HTML? CDN hosting - A CDN or content delivery network is geographically distributed servers to
help reduce latency.
4. What is the advantage of
File compression - This is a method that helps to reduce the size of an asset to reduce the
collapsing white space?
×
data transfer
5. What are HTML Entities? File concatenation - This reduces the number of HTTP calls
Preparing for tech
Minify scripts - This reduces the overall file size of js and CSS files
6. What are different types of lists
interviews? Parallel downloads - Hosting assets in multiple subdomains can help to bypass the
in HTML?
download limit of 6 assets per domain of all modern browsers. This can be configured but
Learn from the best

instructors most general users never modify these settings.


7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE Lazy Loading - Instead of loading all the assets at once, the non-critical assets can be
Try Academy
loaded on a need basis.
8. What is the difference between
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
12.
the ‘id’ attribute and the ‘class’ What are the various formatting tags in HTML?
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 7/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

 HTML has various formatting tags:

<b> - makes text bold


<i> - makes text italic
<em> - makes text italic but with added semantics importance
HTML Interview Questions <big> - increases the font size of the text by one unit
and Answers <small> - decreases the font size of the text by one unit
<sub> - makes the text a subscript
1. Are the HTML tags and
elements the same thing? <sup> - makes the text a superscript
<del> - displays as strike out text
2. What are tags and attributes in <strong> - marks the text as important
HTML?
<mark> - highlights the text

3. What are void elements in <ins> - displays as added text


HTML?
13. What are the different kinds of Doctypes available?
4. What is the advantage of
The three kinds of Doctypes which are available:
collapsing white space?
×
Strict Doctype 
5. What are HTML Entities?
Transitional Doctype
Preparing for tech

6. What are different types of lists Frameset Doctype


interviews?
in HTML?
Learn from the best
14. Please explain how to indicate the character set being used by a
instructors in the field.
7. What is the ‘class’ attribute in
document in HTML?
HTML?for FREE
Try Academy
The character set is defined in <meta> tag inside <head> element.
8. What is the difference between
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 8/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">
...

HTML Interview Questions ...

</head>

and Answers ...

</html>
1. Are the HTML tags and
elements the same thing?
15. What is the difference between <strong>, <b> tags and <em>, <i>
2. What are tags and attributes in
tags?
HTML?
The effect on a normal webpage of the tags <strong>, <b>  and <em>, <i> is the same. <b>
3. What are void elements in and <i> tags stands for bold and italic. These two tags only apply font styling and bold tag
HTML? <b>, just adds more ink to the text, these tags don't say anything about the text.

4. What is the advantage of Whereas, <strong> and <em> tags represent that the span of text is of strong importance or
collapsing white space?
× more importance and emphatic stress respectively than the rest of the text. These tags have
semantic meaning.
5. What are HTML Entities?
Preparing for tech
16. What is the significance of <head> and <body> tag in HTML?
6. What are different types of lists
interviews?
in HTML? <head> tag provides the information about the document. It should always be enclosed in the
Learn from the best
<html> tag. This tag contains the metadata about the webpage and the tags which are
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
enclosed by head tag like <link>, <meta>, <style>, <script>, etc. are not displayed on the web
HTML?for FREE
Try Academy page. Also, there can be only 1 <head> tag in the entire Html document and will always be
before the <body> tag.
8. What is the difference between
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 9/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<body> tag defines the body of the HTML document. It should always be enclosed in the
<html> tag. All the contents which needs to be displayed on the web page like images, text,
audio, video, contents, using elements like <p>, <img>, <audio>, <heading>, <video>, <div>,
etc. will always be enclosed by the <body> tag. Also, there can be only 1 body element in an
HTML document and will always be after the <head> tag.
HTML Interview Questions
and Answers 17. Can we display a web page inside a web page or Is nesting of
webpages possible?
1. Are the HTML tags and
Yes, we can display a web page inside another HTML web page. HTML provides a tag <iframe>
elements the same thing?
using which we can achieve this functionality.
2. What are tags and attributes in
HTML? <iframe src=”url of the web page to embed” />

3. What are void elements in


HTML? 18. How is Cell Padding different from Cell Spacing?
Cell Spacing is the space or gap between two consecutive cells. Whereas, Cell Padding is the
4. What is the advantage of
space or gap between the text/ content of the cell and the edge/ border of the cell. Please refer
collapsing white space?
×
to the above figure example to find the difference.
5. What are HTML Entities?
Preparing for tech
19. How can we club two or more rows or columns into a single row or
6. What are different types of lists
column in an HTML table?
interviews?
in HTML?
Learn from the best
HTML provides two table attributes “rowspan” and “colspan” to make a cell span to multiple
instructors
7. Whatinisthe
thefield. rows and columns respectively.
‘class’ attribute in
HTML?for FREE
Try Academy
20. Is it possible to change an inline element into a block level element?
8. What is the difference between
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
Yes, it is possible using the “display” property with its value as “block”, to change the inline
the ‘id’ attribute and the ‘class’
element into a block-level element.
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 10/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

21. In how many ways can we position an HTML element? Or what are the
permissible values of the position attribute?
There are mainly 7 values of position attribute that can be used to position an HTML element:

HTML Interview Questions 1. static: Default value. Here the element is positioned according to the normal flow of the
and Answers document.
2. absolute: Here the element is positioned relative to its parent element. The final position is
1. Are the HTML tags and determined by the values of left, right, top, bottom.
elements the same thing?
3. fixed: This is similar to absolute except here the elements are positioned relative to the
<html> element.
2. What are tags and attributes in
HTML? 4. relative: Here the element is positioned according to the normal flow of the document and
positioned relative to its original/ normal position.
3. What are void elements in 5. initial: This resets the property to its default value.
HTML? 6. inherit: Here the element inherits or takes the property of its parent.

4. What is the advantage of


22. In how many ways you can display HTML elements?
collapsing white space?
×
1. inline: Using this we can display any block-level element as an inline element. The height
5. What are HTML Entities? and width attribute values of the element will not affect.
Preparing for tech
2. block: using this, we can display any inline element as a block-level element. 
6. What are different types of lists
interviews? 3. inline-block: This property is similar to inline, except by using the display as inline-block,
in HTML?
Learn from the best
we can actually format the element using height and width values.
instructors
7. Whatinisthe
thefield.
‘class’ attribute in 4. flex: It displays the container and element as a flexible structure. It follows flexbox
HTML?for FREE
Try Academy property.
5. inline-flex: It displays the flex container as an inline element while its content follows the
8. What is the difference between flexbox properties.
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
6. grid: It displays the HTML elements as a grid container.
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 11/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

7. none: Using this property we can hide the HTML element.

Below are some of the display types which are rarely used:

1. table
2. inline-table
HTML Interview Questions
3. table-cell
and Answers
4. table-column
1. Are the HTML tags and 5. table-row
elements the same thing? 6. inline-grid
7. list-item
2. What are tags and attributes in
8. inherit
HTML?
9. initial
3. What are void elements in 10. table-caption
HTML?
23. What is the difference between “display: none” and “visibility: hidden”,
4. What is the advantage of
collapsing white space?
when used as attributes to the HTML element.
×
When we use the attribute “visibility: hidden” for an HTML element then that element will be
5. What are HTML Entities? hidden from the webpage but still takes up space. Whereas, if we use the “display: none”
Preparing for tech
attribute for an HTML element then the element will be hidden, and also it won’t take up any
6. What are different types of lists
interviews? space on the webpage.
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
24.
‘class’ attribute in
How to specify the link in HTML and explain the target attribute?
HTML?for FREE
Try Academy HTML provides a hyperlink - <a> tag to specify the links in a webpage. The ‘href’ attribute is
used to specify the link and the ‘target’ attribute is used to specify, where do we want to open
8. What is the difference between the linked document. The ‘target’ attribute can have the following values:
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 12/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

1. _self: This is a default value. It opens the document in the same window or tab as it was
clicked.
2. _blank: It opens the document in a new window or tab.
3. _parent: It opens the document in a parent frame.
4. _top: It opens the document in a full-body window.
HTML Interview Questions
and Answers 25. In how many ways can we specify the CSS styles for the HTML
1. Are the HTML tags and element?
elements the same thing? There are three ways in which we can specify the styles for HTML elements:

2. What are tags and attributes in Inline: Here we use the ‘style’ attribute inside the HTML element.
HTML? Internal: Here we use the <style> tag inside the <head> tag. To apply the style we bind
the elements using ‘id’ or ‘class’ attributes.
3. What are void elements in
External: Here we use the <link> tag inside <head> tag to reference the CSS file into our
HTML?
HTML code. Again the binding between elements and styles is done using ‘id’ or ‘class’
4. What is the advantage of attributes.
collapsing white space?
×

5. What are HTML Entities?


Preparing for tech

6. What are different types of lists


interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
26. Difference between link tag <link> and anchor tag <a>?
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 13/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

The anchor tag <a> is used to create a hyperlink to another webpage or to a certain part of the
webpage and these links are clickable, whereas, link tag <link> defines a link between a
document and an external resource and these are not clickable.

27. How to include javascript code in HTML?


HTML Interview Questions
HTML provides a <script> tag using which we can run the javascript code and make our HTML
and Answers page more dynamic.

1. Are the HTML tags and


elements the same thing? <!DOCTYPE html>

<html>

2. What are tags and attributes in <body>

<h1>

HTML?
<span>This is a demo for </span>

<u><span id="demo"></span></u>

3. What are void elements in


</h1>

HTML? <script>

document.getElementById("demo").innerHTML = "script Tag"

4. What is the advantage of </script>

collapsing white space?


× </body>

</html>
5. What are HTML Entities?
Preparing for tech

28. When to use scripts in the head and when to use scripts in the body?
6. What are different types of lists
interviews?
in HTML?
If the scripts contain some event-triggered functions or jquery library then we should use them
Learn from the best

instructors in the head section. If the script writes the content on the page or is not inside a function then
7. Whatinisthe
thefield.
‘class’ attribute in
it should be placed inside the body section at the bottom. In short, follow below three points:
HTML?for FREE
Try Academy

1. Place library scripts or event scripts in the head section.


8. What is the difference between
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’2. Place normal scripts that do not write anything on the page, in the head section until there
attribute of HTML elements? is any performance issue.
https://www.interviewbit.com/html-interview-questions/ 14/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

3. Place scripts that render something on the web page at the bottom of the body section.

29. What are forms and how to create forms in HTML?


The HTML form is used to collect the user inputs. HTML provides a <form> tag to create forms.
To take input from the user we use the <input> tag inside the form so that all collected user
HTML Interview Questions
data can be sent to the server for processing. There are different input types like ‘button’,
and Answers
‘checkbox’, ‘number’, ‘text’, ‘password’, ‘submit’ etc.

1. Are the HTML tags and


elements the same thing? <form action="/submit_data.php">

<label>Enter your name: </label>

2. What are tags and attributes in <input type="text" name="name" />

HTML? <label>Enter Mobile number </label>

<input type="number" name="mobile_no"/>

<input type="submit" value="Submit">

3. What are void elements in


</form>
HTML?

4. What is the advantage of


30. How to handle events in HTML?
collapsing white space?
×
HTML allows event trigger actions in browsers using javascript or JQuery. There are a lot of
5. What are HTML Entities? events like ‘onclick’, ‘ondrag’, ‘onchange’, etc.
Preparing for tech

6. What are different types of lists


interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 15/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<!DOCTYPE html>

<html>

<body style="padding-top:50px">

<h3 id="event_demo">0</h3>

<input type="button" onclick="myFunction()" value="Click Me" />

HTML Interview Questions <input type="reset" onclick="reset()" value="Reset" />

</body>

and Answers

<script>

1. Are the HTML tags and function myFunction() {

elements the same thing? var value = document.getElementById("event_demo").innerHTML

value = parseInt(value) + 1;

2. What are tags and attributes in document.getElementById("event_demo").innerHTML = value;

HTML? }

function reset() {
3. What are void elements in document.getElementById("event_demo").innerHTML = 0;

HTML? }

</script>

</html>
4. What is the advantage of
collapsing white space?
×

5. What are HTML Entities?


HTML5 Interview Questions
Preparing for tech
31. What are some of the advantages of HTML5 over its previous versions?
6. What are different types of lists
interviews?
in HTML? Some advantages of HTML5 are:-
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in It has Multimedia Support.
HTML?for FREE
Try Academy It has the capabilities to store offline data using SQL databases and application cache.
Javascript can be run in the background.
8. What is the difference between
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
HTML5 also allows users to draw various shapes like rectangles, circles, triangles, etc.
the ‘id’ attribute and the ‘class’
attribute of HTML elements? Included new Semantic tags and form control tags.
https://www.interviewbit.com/html-interview-questions/ 16/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

32. How can we include audio or video in a webpage?


HTML5 provides two tags: <audio> and <video> tags using which we can add the audio or
video directly in the webpage.

HTML Interview Questions33. Inline and block elements in HTML5?


and Answers
Inline Block
1. Are the HTML tags and
elements the same thing? Inline elements just take up the space Block elements start on a new line and
that is absolutely necessary for the consume the full width of the page
2. What are tags and attributes in content and does not start from a new available.

HTML? line.
Example:- <div>, <p>, <header>, <footer>,
Example:- <span>, <a>, <strong>, <h1>...<h6>, <form>, <table>, <canvas>,
3. What are void elements in <img>, <button>, <em>, <select>, <video>, <blockquote>, <pre>, <ul>, <ol>,
HTML? <abbr>, <label>, <sub>, <cite>, <figcaption>, <figure>, <hr>, <article>,
<abbr>, <script>, <label>, <i>, <section>, etc.
4. What is the advantage of <input>, <output>, <q>, etc.
collapsing white space?
×

5. What are HTML Entities?


Preparing for tech

6. What are different types of lists


interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 17/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

34. What is the difference between <figure> tag and <img> tag?
The <figure> tag specifies the self-contained content, like diagrams, images, code snippets, etc.
<figure> tag is used to semantically organize the contents of an image like image, image
caption, etc., whereas the <img> tag is used to embed the picture in the HTML5 document.

HTML Interview Questions


35. How to specify the metadata in HTML5?
and Answers
To specify we can use <meta> tag which is a void tag,i.e., it does not have a closing tag. Some
1. Are the HTML tags and of the attributes used with meta tags are name, content, http-equiv, etc. The below image tells
elements the same thing? how to specify the metadata.

2. What are tags and attributes in


HTML?

3. What are void elements in


HTML?

4. What is the advantage of


collapsing white space?
×
5. What are HTML Entities? 36. Is the <datalist> tag and <select> tag same?
Preparing for tech

No. The <datalist> tag and <select> tag are different. In the case of <select> tag a user will
6. What are different types of lists
interviews?
in HTML? have to choose from a list of options, whereas <datalist> when used along with the <input>
Learn from the best
tag provides a suggestion that the user selects one of the options given or can enter some
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
entirely different value.
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 18/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

HTML Interview Questions


and Answers

1. Are the HTML tags and


elements the same thing?
37. Define Image Map?
2. What are tags and attributesImage
in Map lets a developer map/link different parts of images with the different web pages. It
HTML? can be achieved by the <map> tag in HTML5, using which we can link images with clickable
areas.
3. What are void elements in
HTML?
<img src=”image_url” , usemap=”#workspace” />

4. What is the advantage of <map name=”workspace”>

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

collapsing white space?


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

</map>
5. What are HTML Entities?
Preparing for tech

6. What are different types of lists


interviews? 38. What are Semantic Elements?
in HTML?
Learn from the best
Semantic elements are those which describe the particular meaning to the browser and the
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
developer. Elements like <form>, <table>, <article>, <figure>, etc., are semantic elements.
HTML?for FREE
Try Academy
39. Convert the below data into Tabular format in HTML5?
8. What is the difference between
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
S.no., Language, Mostly used for
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 19/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

1, HTML, FrontEnd

2, CSS, FrontEnd

3, Python, BackEnd

HTML Interview Questions


and Answers

1. Are the HTML tags and


elements the same thing?

2. What are tags and attributes in


HTML?

3. What are void elements in


HTML?

4. What is the advantage of


collapsing white space?
×

5. What are HTML Entities?


Preparing for tech
40. What is the difference between <meter> tag and <progress> tag?
6. What are different types of lists
interviews? <progress> tag should be used when we want to show the completion progress of a task,
in HTML?
Learn from the best
whereas if we just want a scalar measurement within a known range or fraction value. Also, we
instructors
7. Whatinisthe
thefield. can specify multiple extra attributes for <meter> tags like ‘form’, ‘low’, ‘high’, ‘min’, etc.
‘class’ attribute in
HTML?for FREE
Try Academy
41. Is drag and drop possible using HTML5 and how?
8. What is the difference between
Yes, in HTML5 we can drag and drop an element. This can be achieved using the drag and
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
drop-related events to be used with the element which we want to drag and drop.
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 20/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

42. Difference between SVG and Canvas HTML5 element?

SVG Canvas

SVG is a vector based i.e., composed of shapes.  It is Raster based i.e.,


HTML Interview Questions composed of pixels.
and Answers
SVG works better with a larger surface. Canvas works better with a
smaller surface.
1. Are the HTML tags and
elements the same thing? SVG can be modified using CSS and scripts. Canas can only be modified
using scripts.
2. What are tags and attributes in
HTML? SVG is highly scalable. So we can print at high quality It is less scalable.
with high resolution.
3. What are void elements in
HTML?
43. What type of audio files can be played using HTML5?
4. What is the advantage of HTML5 supports the following three types of audio file formats:
collapsing white space?
×
1. Mp3
5. What are HTML Entities?
2. WAV
Preparing for tech

6. What are different types of lists3. Ogg


interviews?
in HTML?
Learn from the best
44. What are the significant goals of the HTML5 specification?
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
These were the target area of the HTML5 specs:
HTML?for FREE
Try Academy
Introduction of new element tags to better structure the web page such as <header> tag.
8. What is the difference between
Forming a standard in cross-browser behavior and support for different devices and
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
platforms
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 21/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

Backward compatible with the older version HTML web pages


Introduction of basic interactive elements without the dependency of plugins such as
<video> tag instead of the flash plugin.

45. Explain the concept of web storage in HTML5.


HTML Interview Questions
This web storage helps in storing some of the static data in the local storage of the browser so
and Answers
that we do not need to fetch it from the server every time we need it. There is a size limit based
1. Are the HTML tags and on different browsers. This helps in decreasing the load time and a smooth user experience.
elements the same thing? There are two types of web storage that are used to store data locally in HTML5:

2. What are tags and attributes in Local Storage - This helps in storing data that will be retained even though the user
HTML? reopens the browser. It is stored for each webapp on different browsers.
Session Storage - This is used for one session only. After the user closes the browser this
3. What are void elements in gets deleted.
HTML?
46. What is Microdata in HTML5?
4. What is the advantage of
collapsing white space? It is used to help extract data for site crawlers and search engines. It is basically a group of
×
name-value pairs. The groups are called items, and each name-value pair is a property. Most of
5. What are HTML Entities? the search engines like Google, Microsoft, Yandex, etc follow schema.org vocabulary to extract
Preparing for tech
this microdata.
6. What are different types of lists
interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 22/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<div itemscope itemtype="http://schema.org/SoftwareApplication">

<span itemprop="name">Interviewbit Games</span> -

REQUIRES <span itemprop="operatingSystem">ANDROID</span><br>

<link itemprop="applicationCategory" href="http://schema.org/GameApplication"/>

<div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRati


HTML Interview Questions RATING:

<span itemprop="ratingValue">4.6</span> (

and Answers
<span itemprop="ratingCount">8864</span> ratings )

</div>

1. Are the HTML tags and <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">

elements the same thing? Price: Rs.<span itemprop="price">1.00</span>

<meta itemprop="priceCurrency" content="INR" />

2. What are tags and attributes in </div>

HTML? </div>

3. What are void elements in


HTML? itemid – The unique, global identifier of an item.
itemprop – Used to add properties to an item.
4. What is the advantage of
itemref – Provides a list of element ids with additional properties.
collapsing white space?
× itemscope – It defines the scope of the itemtype associated with it.
5. What are HTML Entities? itemtype – Specifies the URL of the vocabulary that will be used to define itemprop.
Preparing for tech
The above example will be parsed by Google as
6. What are different types of lists
interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 23/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

HTML Interview Questions


and Answers

1. Are the HTML tags and


elements the same thing?

2. What are tags and attributes in


HTML?

3. What are void elements in


HTML?

4. What is the advantage of


collapsing white space?
×

5. What are HTML Entities?


Preparing for tech

6. What are different types of lists


interviews?
in HTML?
Learn from the best
47. Which tag is used for representing the result of a calculation? Explain
instructors
7. Whatinisthe
thefield. its attributes.
‘class’ attribute in
HTML?for FREE
Try Academy
The <output> tag is used for representing the result of a calculation. It has the following
8. What is the difference between attributes:
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
for - It defines the relationship between the elements used in calculation and result.
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 24/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

form - This is used to define the form the output element belongs to.
name - The name of the output element.

<form oninput = "result.value=parseInt(n1.value)+parseInt(n2.value)">

<input type = "number" name = "n1" value = "1" /> +

<input type = "number" name = "n2" value = "2" /><br />

HTML Interview Questions


The output is: <output name = "result"></output>

and Answers </form>

1. Are the HTML tags and The above example looks like
elements the same thing?

2. What are tags and attributes in


HTML?

3. What are void elements in


HTML? 48. What is new about the relationship between the <header> and <h1>
tags in HTML5?
4. What is the advantage of
collapsing white space? As HTML5 was all about better semantics and arrangements of the tags and elements, the
×
<header> tag specifies the header section of the webpage. Unlike in previous version there was
5. What are HTML Entities? one <h1> element for the entire webpage, now this is the header for one section such as
Preparing for tech
<article> or <section>. According to the HTML5 specification, each <header> element must at
6. What are different types of lists
least have one <h1> tag.
interviews?
in HTML?
Learn from the best

49. Explain HTML5 Graphics.


instructors in the field.
7. What is the ‘class’ attribute in
HTML?for FREE HTML5 supports two kinds of graphics:
Try Academy

8. What is the difference between Canvas - It is like drawing on a whitepaper or a blank webpage. We can add different
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’ graphic designs on web pages with available methods for drawing various geometrical
attribute of HTML elements? shapes.
https://www.interviewbit.com/html-interview-questions/ 25/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<!DOCTYPE HTML>

<html>

<head>

</head>

<body>

HTML Interview Questions <canvas width="300" height="100" style="border:2px solid;"></canvas>

</body>

and Answers
</html>

1. Are the HTML tags and


SVG - Scalable Vector Graphics are used mostly for diagrams or icons. It follows the XML
elements the same thing?
format.
2. What are tags and attributes in<!DOCTYPE html>

HTML? <html>

<body>

3. What are void elements in <svg width="400" height="110">

HTML? <rect width="300" height="100" style="fill:#FFF;stroke-width:2;stroke:#000" />

</svg>

4. What is the advantage of </body>

collapsing white space? </html>


×

5. What are HTML Entities?


Both of the above examples produce this output and represent two different approaches
Preparing for tech

provided by HTML5 to implement graphical aspects in the webpage.


6. What are different types of lists
interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 26/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

50. Explain new input types provided by HTML5 for forms?


Following are the significant new data types offered by HTML5:

Date - Only select date by using type = "date"


HTML Interview Questions Week - Pick a week by using type = "week"
and Answers Month - Only select month by using type = "month"
Time - Only select time by using type = "time".
1. Are the HTML tags and
elements the same thing? Datetime - Combination of date and time by using type = "datetime"
Datetime-local - Combination of  date and time by using type = "datetime-local." but
2. What are tags and attributes in ignoring the timezone
HTML? Color - Accepts multiple colors using type = "color"
Email - Accepts one or more email addresses using type = "email"
3. What are void elements in
HTML? Number - Accepts a numerical value with additional checks like min and max using type =
"number"
4. What is the advantage of Search - Allows searching queries by inputting text using type = "search"
collapsing white space?
× Tel - Allows different phone numbers by using type = "tel"
Placeholder - To display a short hint in the input fields before entering a value using type =
5. What are HTML Entities?
"placeholder"
Preparing for tech

6. What are different types of lists Range - Accepts a numerical value within a specific range using type = "range"
interviews?
in HTML? Url - Accepts a web address using type = "url”
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 27/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<form>

<div>

<label>Date:</label>

<input type="date" id="date" />

<br>

HTML Interview Questions <label>Week:</label>

<input type="week" id="week" />

and Answers
<br>

<label>Month:</label>

1. Are the HTML tags and


<input type="month" id="month" />

elements the same thing? <br>

<label>Time:</label>

2. What are tags and attributes in <input type="time" id="time" />

HTML? <br>

<label>Datetime:</label>

3. What are void elements in <input type="datetime" id="datetime" />

HTML? <br>

<label>Datetime Local:</label>

4. What is the advantage of <input type="datetime-local" id="datetime-local" />

<br>

collapsing white space?


× <label>Color:</label>

<input type="color" id="color"/>

5. What are HTML Entities?


<br>

Preparing for tech


<label>Email:</label>

6. What are different types of lists


interviews? <input type="email" id="email" placeholder="email address" />

in HTML? <br>

Learn from the best


<label>Number:</label>

instructors
7. Whatinisthe
thefield.
‘class’ attribute in<input type="number" id="number" />

HTML?for FREE
Try Academy <br>

<label>Search:</label>

8. What is the difference between <input type="search" id="search" />

Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’ <br>

<label>Phone:</label>

attribute of HTML elements?


https://www.interviewbit.com/html-interview-questions/ 28/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<input type="tel" id="phone" placeholder="Phone Number" pattern="\d{10}$


<br>

<label>Range:</label>

<input type="range" id="range" />

<br>

<label>URL:</label>

HTML Interview Questions <input type="url" id="url"/>

and Answers </div>

</form>

1. Are the HTML tags and


elements the same thing?

2. What are tags and attributes in


HTML?

3. What are void elements in


HTML?

4. What is the advantage of


collapsing white space?
×
5. What are HTML Entities?
Preparing for tech

6. What are different types of lists


interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 29/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

HTML Interview Questions


and Answers

1. Are the HTML tags and


elements the same thing?

2. What are tags and attributes in


HTML?

3. What are void elements in


HTML?

4. What is the advantage of


collapsing white space?
×

5. What are HTML Entities?


51. What are the New tags in Media Elements in HTML5?
Preparing for tech

6. What are different types of lists <audio> - Used for sounds, audio streams, or music, embed audio content without any
interviews?
in HTML? additional plug-in.
Learn from the best

instructors <video> - Used for video streams, embed video content etc.
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE <source> - Used for multiple media resources in media elements, such as audio, video,
Try Academy
etc.
8. What is the difference between
<embed> - Used for an external application or embedded content.
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’ <track> - Used for subtitles in the media elements such as video or audio.
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 30/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<label>

Video:

</label>

<video width="320" height="240" controls>

<source src="video.mp4" type="video/mp4">

HTML Interview Questions <track src="subtitles.vtt" kind="subtitles" srclang="en" label="English">

</video>

and Answers
<br>

<label>

1. Are the HTML tags and Embed:

elements the same thing? </label>

<embed type="video/webm" src="https://www.youtube.com/embed/MpoE6s2psCw" width="


2. What are tags and attributes in <br>

HTML? <label>

Audio:

3. What are void elements in </label>

<audio controls>

HTML?
<source src="audio.mp3" type="audio/mpeg">

</audio>
4. What is the advantage of
collapsing white space?
×

5. What are HTML Entities?


Preparing for tech

6. What are different types of lists


interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 31/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

HTML Interview Questions


and Answers

1. Are the HTML tags and


elements the same thing?

2. What are tags and attributes in


HTML?

3. What are void elements in


HTML?

4. What is the advantage of


collapsing white space?
×
5. What are HTML Entities?
Preparing for tech

6. What are different types of lists


interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 32/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

52. Why do you think the addition of drag-and-drop functionality in


HTML5 is important? How will you make an image draggable in HTML5?
The drag and drop functionality is a very intuitive way to select local files. This is similar to what
most of the OS have copy functionality thus making it very easy for the user to comprehend.
HTML Interview QuestionsBefore the native drag and drop API, this was achievable by writing complex Javascript
and Answers programming or external frameworks like jQuery.

To enable this functionality there is a draggable attribute in the <img> tag and need to set
1. Are the HTML tags and
ondrop and ondragover attribute to an eventhandler available in scripts.
elements the same thing?

2. What are tags and attributes in


HTML?

3. What are void elements in


HTML?

4. What is the advantage of


collapsing white space?
×
5. What are HTML Entities?
Preparing for tech

6. What are different types of lists


interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 33/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<!DOCTYPE HTML>

<html>

<head>

<script>

function allowDrop(ev) {

HTML Interview Questions ev.preventDefault();

and Answers
function drop(ev) {

...

1. Are the HTML tags and


}

elements the same thing? </script>

</head>

2. What are tags and attributes in <body>

HTML? ...

<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)" style="border:


3. What are void elements in <br>

HTML? <img id="drag1" src="img_logo.gif" draggable="true" width="336" height="69">

...

</body>

4. What is the advantage of


</html>
collapsing white space?
×

5. What are HTML Entities?


Preparing for tech
53. Why do we need the MathML element in HTML5?
6. What are different types of lists
interviews? MathML stands for Mathematical Markup Language. It is used for displaying mathematical
in HTML?
Learn from the best
expressions on web pages. For this <math> tag is used.
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 34/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<!DOCTYPE HTML>

<html>

<head>

</head>

<body>

HTML Interview Questions <math>

<mrow>

and Answers
<mrow>

<msup>

1. Are the HTML tags and <mi> a </mi>

elements the same thing? <mn> 2 </mn>

</msup>

2. What are tags and attributes in <mo> + </mo>

HTML? <msup>

<mi> b </mi>

3. What are void elements in <mn> 2 </mn>

HTML? </msup>

<mo> + </mo>

<mn> 2 </mn>

4. What is the advantage of


<mn> a </mn>

collapsing white space?


× <mn> b </mn>

</mrow>

5. What are HTML Entities?


<mo> = </mo>

Preparing for tech


<mn> 0 </mn>

6. What are different types of lists


interviews? </mrow>

in HTML? </math>

Learn from the best


</body>

instructors in the field.


7. What is the ‘class’ attribute in </html>
HTML?for FREE
Try Academy
This displays the equation a2 + b2 + 2ab = 0.
8. What is the difference between
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
54. What are the server-sent events in HTML5?
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 35/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

The events pushed from the webserver to the browsers are called server-sent events. DOM
elements can be continuously updated using these events. This has a major advantage over
straight-up polling. In polling, there is a lot of overhead since every time it is establishing an
HTTP connection and tearing it down whereas, in server-sent events, there is one long-lived
HTTP connection. To use a server-sent event, <eventsource> element is used. The src attribute
HTML Interview Questionsof this element specifies the URL from which sends a data stream having the events.
and Answers
<eventsource src = "/cgi-bin/myfile.cgi" />
1. Are the HTML tags and
elements the same thing?
55. What are Web Workers?
2. What are tags and attributes in
These are added to bring parallelism and async capability. It runs in the background to do the
HTML?
computationally expensive tasks without yielding to make the page responsive. It is achieved by
3. What are void elements in starting a separate thread for such tasks. These are not meant to perform UI operations. There
HTML? are three types of web workers:

4. What is the advantage of Dedicated Workers - These are workers that are utilized by a single script.
collapsing white space?
× Shared Workers -These are workers that are utilized by multiple scripts running in
different windows, IFrames, etc.
5. What are HTML Entities? Service Workers - These act as proxy servers between web applications, the browser, and
Preparing for tech
the network. Mostly used for push notifications and sync APIs.
6. What are different types of lists
interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 36/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<p>Count numbers: <output id="result"></output></p>

<button onclick="startWorker()">Start Worker</button>

<button onclick="stopWorker()">Stop Worker</button>

<script>

var w;

HTML Interview Questions function startWorker() {

if(typeof(Worker) !== "undefined") {

and Answers
if(typeof(w) == "undefined") {

w = new Worker("demo_workers.js");

1. Are the HTML tags and }

elements the same thing? w.onmessage = function(event) {

document.getElementById("result").innerHTML = event.data;

2. What are tags and attributes in};

HTML? }

3. What are void elements in function stopWorker() {

HTML? w.terminate();

w = undefined;

4. What is the advantage of


</script>
collapsing white space?
×
5. What are HTML Entities?
Preparing for tech

6. What are different types of lists


interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

56. What is the usage of a novalidate attribute for the form tag that is
8. What is the difference between
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
introduced in HTML5?
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 37/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

Its value is a boolean type that indicates whether or not the data being submitted by the form
will be validated beforehand. By making this false, forms can be submitted without validation
which helps users to resume later also.

<form action = "" method = "get" novalidate>

HTML Interview Questions Name:<br><input type="name" name="sname"><br>

and Answers Doubt:<br><input type="number" name="doubt"><br>

<input type="submit" value="Submit">

1. Are the HTML tags and </form>

elements the same thing?

2. What are tags and attributes in


57. What are raster images and vector images?
HTML? Raster Images - The raster image is defined by the arrangement of pixels in a grid with exactly
what color the pixel should be. Few raster file formats include PNG(.png), JPEG(.jpg), etc.

3. What are void elements in Vector Images - The vector image is defined using algorithms with shape and path definitions
HTML? that can be used to render the image on-screen written in a similar markup fashion. The file
extension is .svg
4. What is the advantage of
collapsing white space?
× 58. How to support SVG in old browsers?
5. What are HTML Entities? To support old browsers instead of defining the resource of svg in src attribute of <img> tag, it
Preparing for tech
should be defined in srcset attribute and in src the fallback png file should be defined.
6. What are different types of lists
interviews?
in HTML?
Learn from the best
<img src="circle.png" alt="circle" srcset="circle.svg">
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
59. What are different approaches to make an image responsive?
8. What is the difference between Art direction - Using <picture> element the landscape image fully shown in desktop
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’ layout can be zoomed in with the main subject in focus for a portrait layout.
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 38/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<picture>

<source media="(min-width: 650px)" srcset="img_cup.jpg">

<img src="img_marsh.jpg" style="width:auto;">

</picture>

HTML Interview QuestionsBigger Screen (>650px)


and Answers

1. Are the HTML tags and


elements the same thing?

2. What are tags and attributes in


HTML?

3. What are void elements in


HTML?

4. What is the advantage of


collapsing white space?
×

5. What are HTML Entities?


Preparing for tech
For any other screen
6. What are different types of lists
interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 39/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

HTML Interview Questions


and Answers

1. Are the HTML tags and


elements the same thing?

2. What are tags and attributes in


HTML?

3. What are void elements in Resolution switching - Instead of zoom and crop the images can be scaled accordingly
HTML? using vector graphics. Also, this can be further optimized to serve different pixel density
screens as well. 
4. What is the advantage of For example SVG
collapsing white space?
×
5. What are HTML Entities? <svg width="100" height="100">

<circle cx="50" cy="50" r="40"

Preparing for tech


stroke="green" stroke-width="4" fill="yellow" />

6. What are different types of lists


interviews? </svg>
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 40/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

HTML Interview Questions


and Answers

1. Are the HTML tags and 60. What is a manifest file in HTML5?
elements the same thing? The manifest file is used to list down resources that can be cached. Browsers use this
information to make the web page load faster than the first time. There are 3 sections in the
2. What are tags and attributesmanifest
in file
HTML?
CACHE Manifest - Files needs to be cached
3. What are void elements in
Network - File never to be cached, always need a network connection.
HTML?
Fallback - Fallback files in case a page is inaccessible
4. What is the advantage of CACHE MANIFEST

collapsing white space?


× # 2012-06-16 v1.0.0

/style.css

5. What are HTML Entities? /logo.gif

Preparing for tech


/main.js

6. What are different types of listsNETWORK:

interviews? login.php

in HTML?
FALLBACK:

Learn from the best

/html/ /offline.html
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 41/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<!DOCTYPE HTML>

<html manifest="tutorial.appcache">

...

...

</html>
HTML Interview Questions
and Answers
61. What is the Geolocation API in HTML5?
1. Are the HTML tags and Geolocation API is used to share the physical location of the client with websites. This helps in
elements the same thing? serving locale-based content and a unique experience to the user, based on their location. This
works with a new property of the global navigator object and most of the modern browsers
2. What are tags and attributessupport
in this.
HTML?

var geolocation = navigator.geolocation;


3. What are void elements in
HTML?

62. Write HTML5 code to demonstrate the use of Geolocation API.


4. What is the advantage of
collapsing white space?
×
5. What are HTML Entities?
Preparing for tech

6. What are different types of lists


interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 42/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<!DOCTYPE html>

<html>

<body>

<p>Click "try it" button to get your coordinates.</p>

<button onclick="getLocation()">Try It</button>

HTML Interview Questions <p id="demo"></p>

<script>

and Answers
var x = document.getElementById("demo");

1. Are the HTML tags and function getLocation() {

elements the same thing? if (navigator.geolocation) {

navigator.geolocation.getCurrentPosition(showPosition);

2. What are tags and attributes in } else {

HTML? x.innerHTML = "Geolocation functionality is not supported by this browse


}

3. What are void elements in }

HTML?

function showPosition(position) {

x.innerHTML = "Latitude: " + position.coords.latitude +

4. What is the advantage of


"<br>Longitude: " + position.coords.longitude;

collapsing white space?


× }

</script>

5. What are HTML Entities?


</body>

Preparing for tech


</html>
6. What are different types of lists
interviews?
in HTML?
Learn from the best

The above example asks for user permission for accessing the location data via geolocation API
instructors
7. Whatinisthe
thefield.
‘class’ attribute in and after clicking the button the coordinates of the physical location of the client get displayed.
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 43/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

HTML Interview Questions


and Answers

1. Are the HTML tags and 63. Explain Web Components and it’s usage.
elements the same thing? These are used to create reusable custom elements which are very difficult in traditional HTML.
It consists of three technologies:
2. What are tags and attributes in
HTML? Custom elements - These are JavaScript APIs that help in defining custom elements and
their behavior.
3. What are void elements in
Shadow DOM - These are JavaScript APIs that attach an encapsulated shadow DOM tree
HTML?
to an element to keep the element’s features private and unaffected by other parts.
4. What is the advantage of <!DOCTYPE html>

collapsing white space?


× <html>

<head>

5. What are HTML Entities? <meta charset="utf-8">

Preparing for tech


<title>composed and composedPath demo</title>

6. What are different types of lists<script src="main.js" defer></script>

interviews?
in HTML? </head>

Learn from the best


<body>

instructors
7. Whatinisthe ‘class’ attribute in <h1><code>composed</code> and <code>composedPath</code> demo</h1>

thefield.
<open-shadow text="I have an open shadow root"></open-shadow>

HTML?for FREE
Try Academy
<closed-shadow text="I have a closed shadow root"></closed-shadow>

</body>

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
</html>
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 44/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

customElements.define('open-shadow',

class extends HTMLElement {

constructor() {

super();

const pElem = document.createElement('p');

HTML Interview Questions pElem.textContent = this.getAttribute('text');

const shadowRoot = this.attachShadow({mode: 'open'});

and Answers
shadowRoot.appendChild(pElem);

1. Are the HTML tags and }

elements the same thing? );

customElements.define('closed-shadow',

2. What are tags and attributes in class extends HTMLElement {

HTML? constructor() {

super();

3. What are void elements in const pElem = document.createElement('p');

pElem.textContent = this.getAttribute('text');

HTML?
const shadowRoot = this.attachShadow({mode: 'closed'});

shadowRoot.appendChild(pElem);

4. What is the advantage of }

collapsing white space?


× }

);

5. What are HTML Entities? document.querySelector('html').addEventListener('click', e => {

Preparing for tech


console.log(e.composed);
6. What are different types of lists console.log(e.composedPath());

interviews? });
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 45/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

HTML Interview Questions


and Answers
Here 2 custom elements are defined <open-shadow> and <closed-shadow> which takes their
1. Are the HTML tags and
text content and inserts them into a shadow DOM as content of a <p> element.
elements the same thing?
HTML templates - The markup templates are written using <template> and <slot>
2. What are tags and attributes in
elements which can be reused multiple times as the basis of a custom element's structure.
HTML?

3. What are void elements in


HTML?

4. What is the advantage of


collapsing white space?
×
5. What are HTML Entities?
Preparing for tech

6. What are different types of lists


interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 46/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title>Simple template</title>

HTML Interview Questions <script src="main.js"></script>

</head>

and Answers
<body>

<h1>Simple template</h1>
1. Are the HTML tags and
<template id="my-paragraph">

elements the same thing? <style>

p {

2. What are tags and attributes in color: white;

HTML? background-color: #666;

padding: 5px;

3. What are void elements in }

HTML? </style>

<p><slot name="my-text">My default text</slot></p>

4. What is the advantage of </template>

<my-paragraph>

collapsing white space?


× <span slot="my-text">Let's have some different text!</span>

</my-paragraph>

5. What are HTML Entities?


<my-paragraph>

Preparing for tech


<ul slot="my-text">

6. What are different types of lists <li>Let's have some


interviews? different text!</li>

in HTML? <li>In a list!</li>

Learn from the best


</ul>

instructors in the field.


7. What is the ‘class’ attribute in </my-paragraph>

HTML?for FREE
Try Academy </body>

</html>
8. What is the difference between
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 47/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

customElements.define('my-paragraph',

class extends HTMLElement {

constructor() {

super();

const template = document.getElementById('my-paragraph');

HTML Interview Questions const templateContent = template.content;

this.attachShadow({mode: 'open'}).appendChild(

and Answers
templateContent.cloneNode(true)

);

1. Are the HTML tags and }

elements the same thing? }

);

2. What are tags and attributes inconst slottedSpan = document.querySelector('my-paragraph span');

HTML? console.log(slottedSpan.assignedSlot);

console.log(slottedSpan.slot);
3. What are void elements in
HTML?

4. What is the advantage of


collapsing white space?
×
5. What are HTML Entities?
Preparing for tech

6. What are different types of lists


interviews? Here we are reusing the <my-paragraph> template.
in HTML?
Learn from the best

instructors References:
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy Mozilla MDN (https://developer.mozilla.org/en-US/)

8. What is the difference between W3C (https://www.w3.org/)


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 48/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

Additional Resource
Practice Coding (https://www.interviewbit.com/practice/)
How To Become Front End Developer (https://www.interviewbit.com/blog/front-end-
developer/)
HTML Interview Questions CSS Interview Questions (https://www.interviewbit.com/css-interview-questions/)
and Answers

1. Are the HTML tags and


Multiple Choice Questions
elements the same thing? 1. If you have used inline, internal, and external all the 3 stylings in HTML for a single element
then which style will be applied?
2. What are tags and attributes in
HTML?
Inline

3. What are void elements in


Internal
HTML?

4. What is the advantage of External

collapsing white space?


×
None of the above
5. What are HTML Entities?
Preparing for tech
2. Comments in HTML is done by:
6. What are different types of lists
interviews?
in HTML?
Learn from the best
<?-- -->
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE <!-- -->
Try Academy

8. What is the difference between <!-- --!>


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements? </-- -->
https://www.interviewbit.com/html-interview-questions/ 49/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

3. Which of the following is the correct HTML syntax for adding background color?

<p style=”backgroundColor: #a7b8c9”>


<p>
HTML Interview Questions
and Answers <p style=”background-color= #a7b8c9”>
</p>
1. Are the HTML tags and
elements the same thing? <p style=”background-color: #a7b8c9”>
</p>
2. What are tags and attributes in
HTML? <p style=”color: #a7b8c9></p>

3. What are void elements in


4. Which is the correct HTML syntax for adding a link to the image?
HTML?

4. What is the advantage of <a src=”http://www.xyz.com/image”><img


collapsing white space? src=”image path” /></a>
×

5. What are HTML Entities? <a src=”http://www.xyz.com/image”><img


Preparing for tech
href=”image path” /></a>
6. What are different types of lists
interviews?
in HTML? <link href=”http://www.xyz.com/image”>
Learn from the best
<img src=”image path” /></link>
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy <a href=”http://www.xyz.com/image”>
<img src=”image path” /></a>
8. What is the difference between
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
5. Which of the following are not semantic tags?
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 50/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

<div>

<nav>

<article>
HTML Interview Questions
and Answers
<summary>

1. Are the HTML tags and


elements the same thing? 6. Which is the correct attribute to change the size of text?

2. What are tags and attributes in <p style=”textSize: 10px”></p>


HTML?
<p style=”text-size: 10px”></p>
3. What are void elements in
HTML?
<p style=”font-size: 10px”></p>

4. What is the advantage of


<p style=”fontSize: 10px”></p>
collapsing white space?
×

5. What are HTML Entities? 7. What are the correct extensions for saving an HTML file?
Preparing for tech

6. What are different types of lists


interviews? .hml
in HTML?
Learn from the best

.xml
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
.html

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
.htm
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 51/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

option a and c

option c and d

8. HTML attribute values are case-sensitive?


HTML Interview Questions
and Answers True

1. Are the HTML tags and False


elements the same thing?

2. What are tags and attributes9.inUsing which attribute we can add a tooltip in the HTML element.
HTML?
tooltip
3. What are void elements in
HTML? title

4. What is the advantage of ref


collapsing white space?
×
None of the above
5. What are HTML Entities?
Preparing for tech

10. Which of the following is not a value of the attribute display?


6. What are different types of lists
interviews?
in HTML?
Learn from the best
inline-flex
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy flexbox

8. What is the difference between


flex
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 52/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

grid

11. Which of the following is correct about custom attributes in HTML5?

A custom data attribute starts with data-


HTML Interview Questions and would be named based on the
and Answers requirement.

1. Are the HTML tags and The values of these attributes can be
elements the same thing? retrieved using JavaScript APIs or CSS,
similar to standard attribute.
2. What are tags and attributes in
HTML? Both of the above.

3. What are void elements in None of the above


HTML?

12. Which of the following attribute triggers an event when all the media data of a media
4. What is the advantage of
element is loaded?
collapsing white space?
×
5. What are HTML Entities? onloadedmetadata

Preparing for tech

6. What are different types of lists onloadstart


interviews?
in HTML?
Learn from the best
onmessage
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy Onoffline

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
13. Which attribute defines the accelerator key to be used for keyboard access to an element.
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 53/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

data-x

common

accesskey
HTML Interview Questions
and Answers Src

1. Are the HTML tags and 14. How to set the playback speed of audio/video?
elements the same thing?
playbackrate
2. What are tags and attributes in
HTML?
defaultPlaybackrate

3. What are void elements in


currentTime
HTML?

4. What is the advantage of Duration

collapsing white space?


×
15. Which one is not a semantic html5 element?
5. What are HTML Entities?
Preparing for tech
<article>
6. What are different types of lists
interviews?
in HTML?
Learn from the best
<mark>
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE <section>
Try Academy

8. What is the difference between <span>


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 54/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

16. Which of the following method cancels an ongoing watchPosition call?

geolocation.watchPosition()

geolocation.getcurrentPosition()
HTML Interview Questions
and Answers geolocation.clearPosition()

1. Are the HTML tags and geolocation.clearCurrentPosition(


elements the same thing?

17. Which of the following attribute triggers events when the document has changed?
2. What are tags and attributes in
HTML?
onhaschange
3. What are void elements in
HTML? onchange

4. What is the advantage of ischanged


collapsing white space?
×
inputchange
5. What are HTML Entities?
Preparing for tech
18. Why iframe is used?
6. What are different types of lists
interviews?
in HTML?
Learn from the best
To display web page within a web page
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy To display animation within a web page

8. What is the difference between


To display web page without browser
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 55/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

All of the above

19. Which of the following attribute specifies if the user can edit the element's content or not?

content
HTML Interview Questions
and Answers editable

1. Are the HTML tags and contenteditable


elements the same thing?
contextmenu
2. What are tags and attributes in
HTML?
20. Which of the following attribute triggers events before the document is printed?
3. What are void elements in
HTML? beforeprint

4. What is the advantage of onbeforeprint


collapsing white space?
×
onprint
5. What are HTML Entities?
Preparing for tech
onafterprint
6. What are different types of lists
interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in

(/)
HTML?for FREE
Try Academy
Blog (https://www.interviewbit.com/blog/) (https://www.interviewbit.com/blog/)
8. What is the difference between (/pages/about_us/)
(https://www.interviewbit.com/blog/)About Us (/pages/about_us/)
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
(/pages/about_us/)FAQ (/pages/faq/) (/pages/faq/)
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 56/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit

(/pages/contact/)
(/pages/faq/)Contact Us (/pages/contact/)

(/pages/contact/)Terms (/pages/terms/) (/pages/terms/)

(/pages/terms/)Privacy Policy (/pages/privacy/) (/pages/privacy/)


(/pages/privacy/)
(/pages/privacy/)
HTML Interview Questions
(/pages/privacy/)
(https://www.facebook.com/interviewbit) (https://twitter.com/interview_bit) (mailto:hello@interviewbit.com)
and Answers
Practice Questions Fast Track Courses
1. Are the HTML tags and
(/practice/) (/courses/fast-track/)
elements
Programming the same thing?
(/courses/programming/) Python (/courses/fast-track-python/)

Scripting (/courses/shell/) Java (/courses/fast-track-java/)


2. What are tags and attributes in
HTML?
System Design (/courses/system-design/) C++ (/courses/fast-track-cpp/)

Databases (/courses/databases/) Javascript (/courses/fast-track-js/)


3. What are void elements in
Puzzle (/puzzles/)
HTML?

Interview
4. Preparation
What is the advantage of
collapsing
System Design white
Questions space?
×
(/courses/system-design/) Google Interview Questions (/google-interview-questions/)

Facebook
5. Interview
What areQuestions (/facebook-interview-questions/)
HTML Entities? Amazon Interview Questions (/amazon-interview-questions/)

Preparing
Microsoft forQuestions
Interview tech
(/microsoft-interview-questions/) SQL Interview Questions (/sql-interview-questions/)
6. What are different types of lists
interviews?
Python Interview Questions (/python-interview-questions/) Javascript Interview Questions (/javascript-interview-questions/)
in HTML?
MVC Learn
Interview
fromQuestions
the best
(/mvc-interview-questions/) React Interview Questions (/react-interview-questions/)
instructors
7. WhatinQuestions
isthe
thefield.
‘class’ attribute in
jQuery Interview (/jquery-interview-questions/) Angular Interview Questions (/angular-interview-questions/)
HTML?for FREE
Try Academy
Data Structure Interview Questions (/data-structure-interview-questions/) Selenium Interview Questions (/selenium-interview-questions/)

8. What Questions
Directi Interview is the difference between
(/directi-interview-questions/) Yahoo Interview Questions (/yahoo-interview-questions/)
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute
LinkedIn Interview Questionsand the ‘class’
(/linkedin-interview-questions/) VMware Interview Questions (/vmware-interview-questions/)
attribute of HTML elements?
B I t i Q ti (/ b i t
https://www.interviewbit.com/html-interview-questions/
i ti /) Fli k t I t i Q ti (/fli k t i t i ti /) 57/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit
eBay Interview Questions (/ebay-interview-questions/) Flipkart Interview Questions (/flipkart-interview-questions/)

C Interview Questions (c-interview-questions/) Php Interview Questions (php-interview-questions/)

C Sharp Interview Questions (c-sharp-interview-questions/) Web Api Interview Questions (web-api-interview-questions/)

Hibernate Interview Questions (hibernate-interview-questions/) Node Js Interview Questions (node-js-interview-questions/)

Cpp Interview
HTML Questions
Interview(cpp-interview-questions/)
Questions Oops Interview Questions (oops-interview-questions/)

and Answers
Devops Interview Questions (devops-interview-questions/) Machine Learning Interview Questions (machine-learning-interview-
questions/)
1. Are theQuestions
Docker Interview HTML tags and
(docker-interview-questions/) Mysql Interview Questions (mysql-interview-questions/)
elements the same thing?
Css Interview Questions (css-interview-questions/) Laravel Interview Questions (laravel-interview-questions/)

Asp Net 2. What are


Interview tags and
Questions attributes in
(asp-net-interview-questions/) Django Interview Questions (django-interview-questions/)
HTML?Questions (dot-net-interview-questions/)
Dot Net Interview Kubernetes Interview Questions (kubernetes-interview-questions/)

Operating
3. System Interview
What are Questions
void elements in (operating-system-interview- React Native Interview Questions (react-native-interview-questions/)
questions/)
HTML?
Aws Interview Questions (aws-interview-questions/) Git Interview Questions (git-interview-questions/)
4. What is the advantage of
Java 8 Interview Questions (java-8-interview-questions/) Mongodb Interview Questions (mongodb-interview-questions/)
collapsing white space?
×
Dbms Interview Questions (dbms-interview-questions/) Spring Boot Interview Questions (spring-boot-interview-questions/)

Power Bi5.Interview
What areQuestions
HTML Entities?
(power-bi-interview-questions/) Pl Sql Interview Questions (pl-sql-interview-questions/)
Preparing
Tableau Interviewfor tech
(tableau-interview-questions/)
Questions Linux Interview Questions (linux-interview-questions/)
6. What are different types of lists
interviews?
Ansible Interview Questions (ansible-interview-questions/)
in HTML? Java Interview Questions (java-interview-questions/)
Learn from the best

Jenkins Interview Questions (jenkins-interview-questions/) Agile Interview Questions (agile-interview-questions/)


instructors in the field.
7. What is the ‘class’ attribute in
Networking Interview Questions (networking-interview-questions/) Azure Interview Questions (azure-interview-questions/)
HTML?for FREE
Try Academy
Software Testing Interview Questions (software-testing-interview- Automation Testing Interview Questions (automation-testing-interview-
8. What is the difference between
questions/) questions/)
Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’Questions
Android Interview attribute and the ‘class’
(android-interview-questions/) Hr Interview Questions (hr-interview-questions/)
attribute of HTML elements?
R tA iI t i Q ti ( t ii t i ti /) U i I t i Q ti ( i i t i ti /)
https://www.interviewbit.com/html-interview-questions/ 58/59
8/18/2021 Top HTML and HTML5 Interview Questions (2021) - InterviewBit
Rest Api Interview Questions (rest-api-interview-questions/) Unix Interview Questions (unix-interview-questions/)

Multithreading Interview Questions (multithreading-interview-questions/) Typescript Interview Questions (typescript-interview-questions/)

Angular 8 Interview Questions (angular-8-interview-questions/) Salesforce Interview Questions (salesforce-interview-questions/)

Spark Interview Questions (spark-interview-questions/) Bootstrap Interview Questions (bootstrap-interview-questions/)

Web Services Interview Questions (web-services-interview-questions/) Jsp Interview Questions (jsp-interview-questions/)


HTML Interview Questions
and Answers
Html Interview Questions (html-interview-questions/) Hadoop Interview Questions (hadoop-interview-questions/)

Angularjs Interview Questions (angularjs-interview-questions/) Cucumber Interview Questions (cucumber-interview-questions/)


1. Are the HTML tags and
Cyber Security Interview Questions (cyber-security-interview-questions/) Jdbc Interview Questions (jdbc-interview-questions/)
elements the same thing?
Microservices Interview Questions (microservices-interview-questions/) Ccna Interview Questions (ccna-interview-questions/)
2. What
Data Science are tags
Interview and attributes
Questions in
(data-science-interview-questions/) Uipath Interview Questions (uipath-interview-questions/)
HTML?
Cloud Computing Interview Questions (cloud-computing-interview- Spring Interview Questions (spring-interview-questions/)
questions/)
3. What are void elements in
HTML?
Scrum Master Interview Questions (scrum-master-interview-questions/)

4. What is the advantage of


collapsing white space?
×

5. What are HTML Entities?


Preparing for tech

6. What are different types of lists


interviews?
in HTML?
Learn from the best

instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy

8. What is the difference between


Register Now
(https://scaler.com/academy?utm_source=ib&utm_campaign=free_academy&utm_medium=nudge_modal&utm_content=/html
the ‘id’ attribute and the ‘class’
attribute of HTML elements?
https://www.interviewbit.com/html-interview-questions/ 59/59

You might also like