
Basic HTML Interview Questions for Freshers (With Answers)
Preparing for a job as a web developer and wondering what are the most common HTML interview questions? We have got you covered with the frequently asked questions with answers that you may encounter during the interview.
HTML is the core part of designing a website. If you want to be a successful front-end developer or full-stack developer, then you must surely learn HTML. For instance, if you have done a web development course and are applying for a job as a beginner, you must be prepared for the HTML interview questions for freshers.
Whereas, if you have some experience in the field, then be ready for the advanced HTML interview questions and answers for experienced developers.
In this comprehensive write-up, we have covered the common questions with answers for both freshers and experienced professionals. Let’s get started!

The following are the HTML interview questions and answers for freshers, most likely to be asked when you appear for the job. It also includes some HTML CSS interview questions to assist you in getting started or advancing in your web development or HTML profession.
- 1. What is HTML?
- 2. What are the main features of HTML?
- 3. What are HTML tags, and how to use them?
- 4. What Is the difference between HTML elements & HTML tags?
- 5. What Is HTML formatting?
- 6. Do all HTML tags have an end tag?
- 7. Which HTML tags are used to display the data in tabular format?
- 8. What are HTML attributes & how to use them?
- 9. What is the basic structure of an HTML template?
- 10. How many heading tags are there in HTML?
- 11. How to create an HTML hyperlink?
- 12. What is the difference between Block Level Elements & Inline Elements in HTML?
- 13. What are HTML comments?
- 14. What is HTML5? What are new features in it that are not available with HTML?
- 15. What is Semantic HTML?
- 16. How to create a nested webpage in HTML?
- 17. In HTML, can hyperlinks only be applied to text?
- 18. What is a style sheet in HTML?
- 19. What is an image map in HTML?
- 20. What is a marquee in HTML?
1. What is HTML?
This is going to be the most asked HTML interview questions for all experience-level professionals. You must have a clear idea about the basics first.
HTML, also termed Hyper Text Markup Language is a language used on the World Wide Web. It is a common text formatting language utilized for designing and displaying web pages.
Today, text can become more dynamic and interactive because of HTML. It can change text into links, tables, and images. By prefixing the web page name with.html or.html, HTML pages can be stored.
2. What are the main features of HTML?
HTML has the following features and characteristics:
- It is a markup language that allows for the creation of text-based web pages.
- HTML is simple to use and understand.
- While using HTML, programmers can make a web page more interactive by adding images, video, and audio.
- HTML is platform-independent and may be used on Windows, Linux, and others.
- It is not case-sensitive. Tags can be used in either lower or higher case.
- HTML allows programmers to include a link on web pages, allowing readers to search for material of interest.
3. What are HTML tags, and how to use them?
An HTML tag comprises an opening tag, a content tag, and a closing tag. Some tags aren’t closed.
Two things are contained in HTML documents: content and tags.
A web browser examines an HTML document from top to bottom and from left to right. HTML tags are used to construct HTML documents and render their features. It has its own set of attributes.
<tag> content </tag>
Content is added between tags to display data on a web page.
4. What Is the difference between HTML elements & HTML tags?
Here is a tabular comparison of HTML elements vs HTML tags to understand the differences between the two easily:
HTML Elements | HTML Tags |
An HTML element is a standalone component of an HTML web page or document, including a start tag, attributes, end tag, and everything in between | HTML tags are used to indicate the beginning or conclusion of an element |
Elements contain a start tag, content, and an end tag | HTML tags begin with ‘<’ and end with ‘>.’ Whatever is written in between <and> is termed a tag |
Content is hold by HTML elements | An HTML element is hold by HTML tags |
HTML elements define the overall content | HTML tags are similar to keywords, as each tag has a distinct significance. |
Example- <p> This is an example of a paragraph.</p> | Example- <a> represents opening anchor tag </a> represents closing anchor tag |
5. What Is HTML formatting?
HTML formatting is the method of formatting text to make it look and feel better. It employs various tags to make text bold, italic, and underlined.
For example:
<b> This text is bold </b>
<i> This text is italic </i>
<u> This text is underlined </u>
6. Do all HTML tags have an end tag?
No, not all HTML tags have an end tag. Some are self-closing tags that do not require an end tag.
The br> tag, for instance, is used to break a line, and the image> tag is used to insert an image into a page.
7. Which HTML tags are used to display the data in tabular format?
To display the data in tabular form, the following HTML tags are used:
1 | <table> | Represents a table |
2 | <tr> | Defines a row in a table |
3 | <th> | Used for a header cell in a table |
4 | <td> | Defines a cell in the table |
5 | <caption> | Represents the table caption |
6 | <col> | Used with <colgroup> element to specify each column property |
7 | <tbody> | Group the body content in the table |
8 | <thead> | Groups the header content in the table |
9 | <tfooter> | Groups the footer content in a table |
This is one of the most common HTML interview questions for freshers, as they should know about all types of tags used.
8. What are HTML attributes & how to use them?
Each HTML tag has a unique attribute that affects how the tag operates or appears.
For example, a type attribute on an input> tag can be used to indicate whether it’s a text field, checkbox, radio button, etc.
Inside the two angled brackets, attributes are specified directly after the tag’s name. They should only be used in opening or self-closing tags. They can never appear in closing tags.
Using Attributes:
<!-- Text field -->
<input type="text" />
<!-- Checkbox -->
<input type="checkbox" />
<!-- Radio button -->
<input type="radio" value="on" />
9. What is the basic structure of an HTML template?
The basic structure of an HTML template is as follows you must know while preparing for HTML interview questions and answers for freshers:
<html>
<head>
<title>Page Title </title>
</head>
<body>
Page content
</body>
</html>
10. How many heading tags are there in HTML?
There are basically six different types of heading tags used in HTML. Each form of heading tag has a different font size than the others. For instance, H1 is the biggest heading, while H6 is the smallest one.
Example:
<h1>Heading no. 1</h1>
<h2>Heading no. 2</h2>
<h3>Heading no. 3</h3>
<h4>Heading no. 4</h4>
<h5>Heading no. 5</h5>
<h6>Heading no. 6</h6>
11. How to create an HTML hyperlink?
The HTML language has an anchor tag for creating a hyperlink that connects one page to another. These tags can appear in the following formats:
- Unvisited Link– Displays underlined and blue
- Visited Link– Displays underlined and purple
- Active Link– Displays underlined and red
12. What is the difference between Block Level Elements & Inline Elements in HTML?
You must know the differences between block level and inline elements because this can be asked among the interview questions on HTML.
Here is a tabular comparison of block-level elements vs inline elements to understand the differences between the two easily:
Block Element | Inline Element |
A block-level element is represented by a block that stretches to occupy the entire width available to it, i.e., the width of its container, and will always begin on a new line. For Example: <div>, <img>, <section>, <form>, <nav> | Inline elements are defined and only take up the space that is required. Looking at how text flows on a page is the simplest method to understand how they work. For Example: <span>, <b>, <strong>, <a>, <input> |
13. What are HTML comments?
You can add code comments to your HTML document to help you comprehend the code. These are not visible in the browser, but they assist in notifying yourself and other developers about the purpose of a part of HTML.
The beginning of the comment is denoted by !-, and the end is denoted by — >. Anything in the middle will be ignored, even if it contains valid HTML.
For Example:
<!-- This is a comment! -->
<!-- Comments spanning multiple lines -->
<!-- This part is ignored in the browser -->
14. What is HTML5? What are new features in it that are not available with HTML?
HTML5 is the most recent version of the Hypertext Markup Language (HTML). HTML5’s new features include the following:
- SVG, canvas, and other virtual vector graphics are supported by HTML5.
- Vector graphics could only be employed with Flash, VML, or Silverlight in HTML.
- JavaScript can now run within a web browser, thanks to HTML5.
- HTML5 does not use SGML. It has better parsing rules for more compatibility.
- Web SQL databases are used in HTML5 to temporarily store data.
15. What is Semantic HTML?
Semantic HTML is a code that uses HTML markup in web pages and web apps to reinforce semantics. It also defines the meaning of the text rather than just defining its look or form.
Overall, semantic HTML gives meaning to the code that we write.
For Example:
<form>, <table>, and <article>, these tags clearly indicate the content.
16. How to create a nested webpage in HTML?
A nested webpage is displayed using the HTML iframe tag. In other words, it symbolizes a webpage within a webpage. An inline frame is defined by the HTML iframe> tag.
For Example:
<!DOCTYPE html>
<html>
<body>
<h2>HTML example</h2>
Height and width attributes specify the iframe size:
<iframe src="https://www.wscube.co/" height="200" width="300"></iframe>
</body>
</html>
17. In HTML, can hyperlinks only be applied to text?
No, hyperlinks can be placed in both text and graphics. The HTML anchor tag specifies a hyperlink connecting one page to another.
The “href” attribute of the HTML anchor element is the most crucial.
Syntax:
<a href = "..........."> Link Text </a>
18. What is a style sheet in HTML?
A style sheet creates a uniform, transportable, and visually appealing style template. These templates can be used on a variety of web pages.
It covers the appearance and formatting of a markup-language document. The Cascading Style Sheet (CSS) is the most well-known type of style sheet, and it is used to style web pages.
The style sheet provides the following formatting elements:
- Font
- bold, italics, underline
- Justification
- Color
- Superscript and subscript
19. What is an image map in HTML?
An image map connects multiple web pages with a single image. It is represented by map> tag. You can describe the image shapes you want to include in an image mapping.
20. What is a marquee in HTML?
A marquee represents the scrolling text on a web page. It automatically scrolls the image or text up, down, left, or right.
You should put the text to scroll within the marquee>……/marquee> tag.