0% found this document useful (0 votes)
98 views12 pages

HTML Interview Questions

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
98 views12 pages

HTML Interview Questions

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 12

“As a regular attendee of the Masterclass, I feel the most valuable part

about Scaler Academy's Masterclasses is the unparalleled content


quality that they deliver. A 3 hour Masterclass is very helpful and good
enough for the te
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?
6. What are different types of lists in HTML?
7. What is the ‘class’ attribute in HTML?
8. What is the difference between the ‘id’ attribute and the ‘class’ attribute of
HTML elements?
9. Define multipart form data?
10. Describe HTML layout structure.
11. How to optimize website assets loading?
12. What are the various formatting tags in HTML?
13. What are the different kinds of Doctypes available?
14. Please explain how to indicate the character set being used by a
document in HTML?
15. What is the difference between , tags and , tags?
16. What is the significance of and tag in HTML?
17. Can we display a web page inside a web page or Is
nesting of webpages possible?
18. How is Cell Padding different from Cell Spacing?
19. How can we club two or more rows or columns into a
single row or column in an HTML table?
20. Is it possible to change an inline element into a block level
element?
HTML Interview Questions and Answers
( Continued)

21. In how many ways can we position an HTML


element? Or what are the permissible values of the
position attribute?
22. In how many ways you can display HTML elements?
23. What is the difference between “display: none” and
“visibility: hidden”, when used as attributes to the
HTML element.
24. How to specify the link in HTML and explain the target
attribute?
25. In how many ways can we specify the CSS styles for the
HTML element?
26. Difference between link tag and anchor tag ?
27. How to include javascript code in HTML?
28. When to use scripts in the head and when to use scripts in
the body?
29. What are forms and how to create forms in HTML?
30. How to handle events in HTML?

HTML5 Interview Questions


31. What are some of the advantages of HTML5 over its previous
versions?
32. How can we include audio or video in a webpage?
33. Inline and block elements in HTML5?
34. What is the

difference between

tag and tag?

35. How to specify the metadata in HTML5?


This article covers the most frequently asked HTML and HTML5 questions asked in
interviews.

Introduction

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 and it tells the browser what to display and
how to display.
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 because HTML only defines the structure of the
data that will be rendered on the browser in a webpage, to make it visually
appealing and to make it functional, we will need to use CSS and Javascript
respectively.
The latest version of HTML is HTML5. There are two main components in HTML
language, Tags and Attributes. The below image shows some basic HTML tags
and attributes.
HTML Interview Questions and Answers

1. Are the HTML tags and elements the same thing?


No. HTML elements are defined by a starting tag, may contain some content
and a closing tag.For example, <h1>Heading 1</h1> is a HTML element but
just <h1> is a starting tag and </h1> is a closing tag.

2. What are tags and attributes in HTML?


Tags are the primary component of the HTML that defines how the content will
be structured/ 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 the attribute using which
we will align the paragraph to show in the center of the view.

3. What are void elements in HTML?


HTML elements which do not have closing tags or do not need to be closed are Void
elements. For Example <br />, <img />, <hr />, etc.

4. What is the advantage of collapsing white space?


In HTML, a blank sequence of whitespace characters is treated as a single space
character, Because the browser collapses multiple spaces into a single space
character and this helps a developer to indent lines of text without worrying
about multiple spaces and maintain readability and understandability of HTML
codes.

5. What are HTML Entities?


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 between the reserved character and its
respective entity character to be used.

Character Entity Name Entity Number

< &lt; &#60;

> &gt; &#62;

& &amp; &#38;


6. What are different types of lists in HTML?

7. What is the ‘class’ attribute in HTML?


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

8. What is the difference between the ‘id’ attribute


and the ‘class’ attribute of HTML elements?
Multiple elements in HTML can have the same class value, whereas a value of id
attribute of one element cannot be associated with another HTML element.

9. Define multipart form data?


Multipart form data is one of the values of the enctype attribute. It is used to
send the file data to the server-side for processing. The other valid values of the
enctype attribute are text/plain and application/x-www-form-urlencoded.

10. Describe HTML layout structure.


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.
<footer>: Represents the last section of the page.
<nav>: The navigation menu of the HTML page.
<article>: It is a set of information.
<section>: It is used inside the article block to define the basic structure
of a page.
<aside>: Sidebar content of the page.

11. How to optimize website assets loading?


To optimize website load time we need to optimize its asset loading and for that:

CDN hosting - A CDN or content delivery network is geographically


distributed servers to help reduce latency.
File compression - This is a method that helps to reduce the size of an
asset to reduce the data transfer
File concatenation - This reduces the number of HTTP calls

Minify scripts - This reduces the overall file size of js and CSS files
Parallel downloads - Hosting assets in multiple subdomains can help to
bypass the download limit of 6 assets per domain of all modern browsers.
This can be configured but most general users never modify these settings.
Lazy Loading - Instead of loading all the assets at once, the non-critical
assets can be loaded on a need basis.

12. What are the various formatting tags in HTML?


HTML has various formatting tags:
<b> - makes text bold
<i> - makes text italic
<em> - makes text italic but with added semantics importance
<big> - increases the font size of the text by one unit
<small> - decreases the font size of the text by one unit
<sub> - makes the text a subscript
<sup> - makes the text a superscript
<del> - displays as strike out text
<strong> - marks the text as important
<mark> - highlights the text
<ins> - displays as added text

13. What are the different kinds of Doctypes available?


The three kinds of Doctypes which are
available: Strict Doctype
Transitional Doctype
Frameset Doctype

14. Please explain how to indicate the character set


being used by a document in HTML?
The character set is defined in <meta> tag inside <head> element.

15. What is the difference between , tags and , tags?


The effect on a normal webpage of the tags <strong>, <b>
and <em>, <i> is the same. <b> and <i> tags stands for
bold and italic. These two tags only apply font styling and
bold tag <b>, just adds more ink to the text, these tags don't
say anything about the text.
31. What are some of the advantages of HTML5 over its
previous versions?
Some advantages of HTML5
are:- It has Multimedia
Support.
It has the capabilities to store offline data using SQL databases and
application cache.
Javascript can be run in the background.

HTML5 also allows users to draw various shapes like rectangles, circles,
triangles, etc.
Included new Semantic tags and form control tags.

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.

33. Inline and block elements in HTML5?

Inline elements just take up


the space that is absolutely
necessary for the content and
does not start from a new line.
Example:- <span>, <a>,
<strong>, <img>,
<button>, <em>, <select>,
<abbr>, <label>, <sub>,
<cite>, <abbr>, <script>,
<label>, <i>, <input>,
<output>, <q>, etc.
Block elements start
on a new line and
consume the full width
of the page available.
Example:- <div>, <p>, <header>,
<footer>, <h1>...<h6>, <form>,
<table>, <canvas>, <video>,
<blockquote>, <pre>, <ul>,
<ol>, <figcaption>, <figure>,
<hr>, <article>, <section>, etc
34. What is the difference

between tag and 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.

35. How to specify the metadata in HTML5?


To specify we can use <meta> tag which is a void tag,i.e., it does not have a
closing tag. Some of the attributes used with meta tags are name, content,
http-equiv, etc. The below image tells how to specify the metadata.

You might also like