Top 50 HTML Interview Questions

After study, the toughest stage is how to crack an interview. Going for a job interview make us feel like we are back in school examination. In interview, our job is to show our hidden talent and convince a recruiter that we have a required talent. We have limited time to provide true representation of our skills, experience and knowledge to recruiters.

1. What is HTML?

HTML is the short form of “Hypertext Markup Language”. It is a computer language used to create web pages by using the ordinary text. It is not so difficult to learn and understand. It consists with some syntax and code words same as like other computer languages. The HTML file must be saved with .html extension.

2. Describe the different versions of HTML?

HTML has come with so many different versions from beginning to till like HTML, HTML+, HTML 2.0, HTML 3.2, HTML 4.0 and the latest version HTML 5.

3. What is DOCTYPE?

DOCTYPE means Document Type Declarations. It is used to specify the web browsers that which types of documents (such as SGML or XML Documents) it will receive. In the HTML program, the <!DOCTYPE> comes above the <html> tag.

4. What are the HTML tags?

HTML tags consist with three main elements which are opening tag, content and a closing tag, but some tags need only open tag not close tag. The opening and closing tags are written in the angle brackets like <>. The opening tag is the indication to start the command and the closing tag is the indication to close the command, hence it comes with the slash.   See the syntax below:

<tag> content </tag>

5. How many types of HTML tags?

Generally, HTML tags come in two types paired tag and unpaired tag. The paired tags are much, but unpaired tags are very less.

The examples of paired tags are <p> </p>, <h1> </h1>, <b> </b>, <i> </i>, etc.

The unpaired tags are <br>, <img>, etc.

6. Name the list tags which are used to design a web page?

List tags are very helpful to design a systematic web page. See below the list tags, which make your web page orderly.

  • ordered list
  • unordered list
  • definition list
  • menu list
  • directory list

All these tags can be used to compose a web page

7. How can we add a comment in the HTML?

The comment in the HTML starts with “<!-” tag and ends with “->”

For example:

<!- Add Comment Here ->

8. Name the basic editors of HTML?

There are many editors used to make HTML programs such as Notepad, Notepad++, EditPlus and WYSIWYG HTML editors etc.

9. How to change the font size in HTML?

To change the font size in HTML, use <font> tag using size attributes like this <font size=”5 “> tag. Font size can be changed according to the usage of the web page.

10. What is image map in HTML?

Image mapping helps to link other web pages using a single image on a web page. You can specify the shape of your image during the image mapping.

11. How can we create links within the same page?

Links can be developed by using the <a> tag, with referencing by the use of the number (#) symbol. For instance, you can have one line as <a href=”#abc.html”> Read More </a>, it creates a link to the page abc.html means when you click on this link, so page abc.html will open.

12. Does a hyperlink apply to text only?

No, the hyperlink is not limited to only the text content; rather it applied on the images also. So, you can use any image as a link and allow it to connect with the other file also.

13. What is the list in HTML? How to create it?

There is a list tag in HTML which allows making a list in a web page. It comes with three types:

Ordered List or Numbered List (ol)

Unordered List or Bulleted List (ul)

Description List or Definition List (dl)

14. What bullet types are available in HTML?

To insert bullets in your page, you should use the unordered lists. It contains different list types of attributes like disc, square, or circle.

15. How can you set numbered list in HTML?

To give numbering to your web page list, you should use ordered list in which two types available alphabetic and Roman numerals, you can choose your favorite attribute.

16. How can we change the background color in HTML?

The background color will change by using attribute bgcolor in the <body> tag.

For example: <body bgcolor=”#FF00FF”>

17. How do you create multicolored text in a webpage?

To colored text with different colors, apply the <font color=”color”> ….. </font> tags for each character of your web page in which you want to make the colored text. You can also use this tag in the combination as several times as required, surrounding a single character or whole word.

18. What are the different types of Headings supported by HTML?

HTML headings designed especially to highlight the contents of the documents as a heading. There are 6 heading tags available in the HTML from <h1> to <h6>. Each heading has fix size in which <h1> is bigger most and <h6> is the smallest heading.

19. How can we change the size of any image in HTML file?

In HTML, we can change the size of any image with the help of attributes in tags, see below:

<img src=”xyz.png” alt=”First Image” height=”450″ width=”300″>

20. How to create Tables using HTML?

To create table in the HTML, use <table> tag. With the table tag, we have to divide a HTML table with row as <tr>. Likewise <td> table data and <th> table heading.

See Example Below:

<th> Student Name </th>
<th> Marks </th>
<td> Sonoo </td>
<td> 60 </td>
<td> James </td>
<td> 80 </td>
<td> Swati </td>
<td> 82 </td>

21. What is style sheet?

A Style Sheet is used to make well designed web page. It is a collection of style rules that that instructs a web browser how the different styles are to be applied to the HTML tags to show the web page.

22. Can we set specific colors for table borders?

Yes, we can set specific color to the table border with the help of CSS (Cascading Style Sheet). Here, we have to give command like this:

table, th, td {

border: 1px solid black;


23. What is marquee?

Marquee is HTML tag, used to add scrolling text or image vertically or horizontally on the web page. With this tag, you can move your text or image up, down, right, left automatically.

See its syntax: <marquee> Your Text </marquee>

24. What is HTML form?

HTML form is made especially to get the data from the site visitors. Generally, it is used for registration in which users need to feed their basic details like name, address, email, etc. Its syntax starts from <form> tag and ends with </form> tag.

See below:


Name <input type="text" name="name">

Address <input type="text" name="add">


25. How can we use JavaScript along with HTML?

We can use JavaScript in a HTML document by using <script> tag. This tag must be inserted in the HTML <body> tag.

HTML5 Question – Answer

26. What is HTML5?

HTML5 is a most recent version of HTML. It comes with various new and lucrative features like drawing, animation, video and audio. HTML5 is developed with the aim to give everything to the user without the help of plug ins. In the previous version, users found some issues to develop a web page, but this new version is really very flexible and makes your task easier and faster too.

27. Why do we use HTML5?

HTML5 supports animation, drawing, video, GUI, etc. With these features, developers can make web page quickly without any trouble. It reduces the time of web page development. This is the reason, developers use HTML5 to create web pages.

28. Name the different new form element types in HTML 5?

The HTML5 introduces new form elements to make your web page attractive, see below the list of elements:

Color, Date, Datetime-local, Email, Time, URL, Range, Telephone, Number, Search

Each element has its own feature to make your page appropriate.

29. What are HTML5 graphics?

There are two types of HTML5 graphics which are SVG (Scalable Vector Graphics) and Canvas. The SVG is used to make attractive designs, logos, charts in your webpage. The HTML tag <svg> is a container for SVG graphics. It is used to make drawing paths, boxes, circle, text and graphic pictures.

Canvas is a rectangular area on HTML, it is used to draw graphics on the fly via JavaScript. The HTML tag <canvas> is a container for Canvas graphics of HTML5.

30. Which web browsers support HTML5?

All types of browsers like Google Chrome, Mozilla Firefox, Apple Safari, Opera, Apple Safari, etc. support the HTML5.

31. Which video formats are supported by HTML5?

HTML5 supports three types of video formats which are: mp4, webm and ogg. Generally, HTML video tag is used for streaming video files such as song clip, movie clip on a web page.

32. Which two new tags are included in HTML5?

In HTML5, the <video> and <audio> tags are new tags. These are best alternatives of Silverlight, Flash and similar technologies to use multimedia item in a web page.

33. What is the figure tag in HTML5?

The figure tag is used to insert an image in the document. As we know that HTML has img tag to insert an image, but HTML5 brings figure tag which can handle groups of diagrams, pictures and code listings.

34. What is button tag in HTML5?

The button tag is used to make a clickable button within the HTML form on the web page. Generally, it is used to develop a “submit” or “reset” button.

35. Is audio tag supported to the HTML5?

Yes, audio tag is used to insert sound or music files on the web page.

36. How section tag works in HTML5?

The section tag shows a generic document or application section. It can be used together with the headings h1-h6 to specify the document structure.

37. What is the meaning of local storage in HTML 5?

When a user is filling a long form of a website and internet connection breaks off that time user needs to store this information locally and when the internet come back, so he can get the stored information, fill the remaining form and send to the server.

38. Name the new form elements of HTML5?

In HTML5, some new form elements added to enhance the functionality, which are:

<datalist> – It indicates a list of options for input controls. These options are pre-defined.

<keygen> – This tag shows a key-pair generator field.

<output> – It signifies the result of a calculation.

39. Which method is used to draw an image on the canvas?

In the HTML5, use drawImage(image,x,y) method to draw an image on the canvas of document.

40. How do you make an image draggable?

In the HTML5, you can find drag and drop facility. To make an image draggable, use draggable attribute set it to true.

41. How can we get geographical position of user in HTML5?

We can get the location of a user with the Geolocation API in HTML5. The getCurrentPosition() method is used to get the user’s recent position.

42. What is the Application Cache in HTML5? Why we use it?

The HTML5 introduced Application Cache which can be access without the help of internet connection.

See the main reasons why we use Application Cache in HTML5:

  • Offline browsing – Users can use the application when they have no internet connection
  • Speed – Cached resources load quicker
  • Reduced server load – The browser will only download updated resources from the server.

43. What is the role of autocomplete attribute in HTML5?

The autocomplete attribute is used especially in the form filling function, if a form or input field should have autocomplete as on or off.  If it is on, the browser is capable to fill the values based on the values filled by the user earlier. And if the autocomplete works for following input types: text, search, url, tel, email, password, datepickers, range, and color.

44. Name the five new input types provided by HTML5 for forms and explain their functionalities?

See the most important and new data types offered by HTML5:

  • Date: With this type, user can select a date.
  • datetime-local: It allows the user to select a date and time without time zone.
  • datetime: It allows the user to select a date and time with the time zone.
  • month: It allows the user to choose a month and year in the form.
  • email: This field is used to contain an e-mail address.

45. What is the use of fieldset tag in HTML5?

The fieldset tag makes group related form elements in the HTML5. It is like a box, which is used to draw a box around related form elements. It must start with a <legend> tag, because the <legend> tag specifies the title of the field set.

By using the <fieldset>tag and the <legend> tag in HTML5, you can create very simple form which is easy to use for any user.


<fieldset> Controls </fieldset>

46. What is the use of cite tag in HTML5?

The <cite> tag shows a citation. It specifies the title of a work (like a book, paper, essay, poem, score, song, script, film, TV show, game, painting, sculpture, play, exhibition, etc.). This tag is an inline tag that shows “defining a citation”. The text within the <cite> tag is displayed in Italics. The cite tag must have an open and close tag.

In this tag the “title” attribute shows the title of the text within the <cite> </cite> tags.


<cite title=”value”> Some Text Here </cite>

47. What is Web SQL Database in HTML 5?

Web SQL is a very remarkable feature, even though it is not a part of the HTML 5 specification, but it is a separate specification and it can still support to develop Web Applications. Web SQL is used to operate a client-side database. We can use Web SQL database only in the current versions of browsers like Safari, Google Chrome and Opera.

48. What is Flexbox in HTML 5?

Flexbox is not a single property of any element, but it is a set of properties on the parent element and their children. Basically the parent is a storage place. It is probably a div called a flex container and the children are the elements which are called flex items.

49. What are frames in HTML5?

Frames are the tags which allow multiple HTML documents to be present as independent windows within a main web browser. They allow you to show two or more documents at once. A <Frames document> can be declared by using the <FRAMESET> element. A regular HTML Frameset document has a start element and an end element. This element can hold one or more elements. The SRC attribute of the frameset element points to the document that you need to display in a frame. The ROWS AND COLS attributes of frameset elements shows the layout of the frame.

50. How form validate attribute works in HTML5?

The form validate is a boolean attribute. It identifies that the <input> element should not be authenticated when submitted. It is used with type=”submit”. It overrides the novalidate attribute of the <form> element.

Coding Tag

Coding Tag always happy to serve you in Information Technology (IT). Learn HTML, CSS, Javascript, PHP, Android, Digital Marketing, Latest IT News and many more.

Leave a Reply

Notify of