Top HTML and HTML5 Interview Questions (2021) - InterviewBit
Top HTML and HTML5 Interview Questions (2021) - InterviewBit
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
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.
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
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
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:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
...
</head>
</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” />
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.
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?
×
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
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.
<html>
<h1>
HTML?
<span>This is a demo for </span>
<u><span id="demo"></span></u>
HTML? <script>
</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
3. Place scripts that render something on the web page at the bottom of the body section.
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
<!DOCTYPE html>
<html>
<body style="padding-top:50px">
<h3 id="event_demo">0</h3>
</body>
and Answers
<script>
value = parseInt(value) + 1;
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?
×
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
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?
×
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
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.
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
</map>
5. What are HTML Entities?
Preparing for tech
1, HTML, FrontEnd
2, CSS, FrontEnd
3, Python, BackEnd
SVG Canvas
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
<span itemprop="ratingValue">4.6</span> (
and Answers
<span itemprop="ratingCount">8864</span> ratings )
</div>
HTML? </div>
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
form - This is used to define the form the output element belongs to.
name - The name of the output element.
1. Are the HTML tags and The above example looks like
elements the same thing?
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>
</body>
and Answers
</html>
HTML? <html>
<body>
</svg>
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
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
<form>
<div>
<label>Date:</label>
<br>
and Answers
<br>
<label>Month:</label>
<label>Time:</label>
HTML? <br>
<label>Datetime:</label>
HTML? <br>
<label>Datetime Local:</label>
<br>
in HTML? <br>
instructors
7. Whatinisthe
thefield.
‘class’ attribute in<input type="number" id="number" />
HTML?for FREE
Try Academy <br>
<label>Search:</label>
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>
<label>Range:</label>
<br>
<label>URL:</label>
</form>
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
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>
and Answers
<br>
<label>
HTML? <label>
Audio:
<audio controls>
HTML?
<source src="audio.mp3" type="audio/mpeg">
</audio>
4. What is the advantage of
collapsing white space?
×
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
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?
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
<!DOCTYPE HTML>
<html>
<head>
<script>
function allowDrop(ev) {
and Answers
function drop(ev) {
...
</head>
HTML? ...
...
</body>
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<mrow>
and Answers
<mrow>
<msup>
</msup>
HTML? <msup>
<mi> b </mi>
HTML? </msup>
<mo> + </mo>
<mn> 2 </mn>
</mrow>
in HTML? </math>
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
<script>
var w;
and Answers
if(typeof(w) == "undefined") {
w = new Worker("demo_workers.js");
document.getElementById("result").innerHTML = event.data;
HTML? }
HTML? w.terminate();
w = undefined;
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.
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>
</picture>
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
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">
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
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
/style.css
interviews? login.php
in HTML?
FALLBACK:
/html/ /offline.html
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
<!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?
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
<!DOCTYPE html>
<html>
<body>
<script>
and Answers
var x = document.getElementById("demo");
navigator.geolocation.getCurrentPosition(showPosition);
HTML?
function showPosition(position) {
</script>
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
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>
<head>
interviews?
in HTML? </head>
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>
customElements.define('open-shadow',
constructor() {
super();
and Answers
shadowRoot.appendChild(pElem);
customElements.define('closed-shadow',
HTML? constructor() {
super();
pElem.textContent = this.getAttribute('text');
HTML?
const shadowRoot = this.attachShadow({mode: 'closed'});
shadowRoot.appendChild(pElem);
);
interviews? });
in HTML?
Learn from the best
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Simple template</title>
</head>
and Answers
<body>
<h1>Simple template</h1>
1. Are the HTML tags and
<template id="my-paragraph">
p {
padding: 5px;
HTML? </style>
<my-paragraph>
</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',
constructor() {
super();
this.attachShadow({mode: 'open'}).appendChild(
and Answers
templateContent.cloneNode(true)
);
);
HTML? console.log(slottedSpan.assignedSlot);
console.log(slottedSpan.slot);
3. What are void elements in
HTML?
instructors References:
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy Mozilla MDN (https://developer.mozilla.org/en-US/)
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
3. Which of the following is the correct HTML syntax for adding background color?
<div>
<nav>
<article>
HTML Interview Questions
and Answers
<summary>
5. What are HTML Entities? 7. What are the correct extensions for saving an HTML file?
Preparing for tech
.xml
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy
.html
option a and c
option c and d
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
grid
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.
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
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
geolocation.watchPosition()
geolocation.getcurrentPosition()
HTML Interview Questions
and Answers geolocation.clearPosition()
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
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
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/)
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/)
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/)
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
instructors
7. Whatinisthe
thefield.
‘class’ attribute in
HTML?for FREE
Try Academy