Connect with us


HTML interview questions and answers for freshers



1. Introduction

Are you an interviewer or looking for a job? These tricky HTML interview questions and answers for freshers will help you to boost up your knowledge.

If you are planning for an interview as a web designer you must have knowledge of HTML, CSS, javascript, bootstrap. The first thing you need to know to crack an interview you must have knowledge.

If you are just memorizing question and not understanding then you are just wasting your time. One thing which I would recommend you guys if you want to join IT industries you will have to learn lifelong. Every day you will see new technology in the market and you will have to learn for the survival.

html interview questions and answers for freshers

Read also:-
javascript pdf [How to convert web to pdf using javascript]

Alright let’s begin on tricky html interview questions and answers for freshers

List of HTML interview questions and answers for freshers

1. What is HTML ?

HTML stands for Hypertext Markup Language. It is not a programming language it is used to give the structure to the web page. In HTML you can’t write programming logic. HTML initially released 1993 and it was developed by Tim Berners-Lee.

2. Why do we use doctype in HTML?

Is <!DOCTYPE html> is a html tag ?
No, <!DOCTYPE html> is not a HTML tag.

<!DOCTYPE html> tag basically help browser to detect the document type. Well, I guess you already know browser start reading the page from top to bottom and tag we always use in the beginning. So it helps the browser to detect the document type. It gives the instruction to the browser.

Here are the few examples of doctype.

doctype html
Doctype html

3. Why do we use of data-* attribute?

data attribute were introduced in HTML5. With the help of data-* attribute, We can embed the custom data in the element.
Here is the good example of data attribute
Syntax of data-* attribute:-

<button onclick="showAttribute(this)" 
data-button="blue button">Button</button>

4. What is semantic HTML?

Semantic elements are those element which do their work according to name. For example <table> and <td> (table data) these elements clearly shows their job and they have some meaning. While <span> and <div> is not meaningful hence <body><li><table> etc. are semantic HTML

5. What is the major difference between span and div?

div is basically a block html tag while span is an inline html tag. Here is the example.

div vs span
	<body style="background-color: yellow">
	<div>I am div</div>
	<div>I am div</div>
	<div>I am div</div>
	<span>I am span</span>
	<span>I am span</span>
	<span>I am span</span>

6. Do all HTML tags come in a pair?

No, Because HTML has two types of tags which are empty and non-empty. Those element contains some value in between starting tag and ending know as non-empty tag for example <button></button>
and those element does not contain any value know as empty tag for example <hr> <br> <img>

7. Does a hyperlink only apply to text?

No, We can use a hyperlink on many HTML tags like images, videos, button, list, and many other HTML tags

8. What is the use of the required attribute in HTML5?

Let’s assume that you’ve created a form and you created three fields like name, address, email and you want that name and email must have some value then you will use the required attribute. With the help of required attribute user won’t be able to submit empty value.

Required attribute example
Required attribute example
<form action="/some_action_page.php">
  Name: <input type="text" name="name" required><br>
  Address: <input type="text" name="address"><br>
  Email: <input type="text" name="email" required><br>
  <input type="submit">

9. How many types of heading does HTML contain?

Currently HTML have 6 types of heading which is <h1><h2><h3><h4><h5><h6>
<h1> is a big size heading mainly use for the title of the topic while <h6> is a smallest heading.

10. What is a Hyperlink and how can we create it?

HTML has a link which is known as the hyperlink. It is basically the reference to another page. You can detect a link by hovering over it and the mouse pointer will turn into a hand.

<a href="">PowerTech Lab</a>

As you can see in the above example we are using <a> HTML tag which is used for defining the link in Website and href attribute used for addressing the location. It can be domain URL or a specific page of a domain.

If you still have any doubt on HTML interview questions and answers for freshers please let me know in comments.

Continue Reading


  1. Shonda Rushing

    February 5, 2019 at 10:33 pm

    Your place is valueble for me. Thanks!…

  2. Melony Odea

    February 23, 2019 at 5:18 pm

    A powerful share, I just given this onto a colleague who was doing a little bit analysis on this. And he in reality bought me breakfast because I discovered it for him.. smile. So let me reword that: Thnx for the deal with! However yeah Thnkx for spending the time to discuss this, I really feel strongly about it and love studying extra on this topic. If attainable, as you develop into experience, would you thoughts updating your blog with more particulars? It is extremely useful for me. Massive thumb up for this blog post!

  3. Edmundo Huor

    March 11, 2019 at 12:09 am

    wohh precisely what I was searching for, thanks for putting up.

Leave a Reply

Your email address will not be published. Required fields are marked *