Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
What is HTML?
2.
HTML Interview Questions and Answers
2.1.
1. What do you mean by Tags?
2.2.
2. Do all HTML tags have an end tag?
2.3.
3. What do you mean by Image Maps?
2.4.
4. What is formatting in HTML?
2.5.
5. How many types of heading does HTML contain?
2.6.
6. How to create a hyperlink in HTML?
2.7.
8. Which HTML tag do we use to display the data in the tabular form?
2.8.
9. What is the significance of the head and the body tag?
2.9.
10. What is the difference between HTML tags and elements?
2.10.
11. What are empty elements?
2.11.
12. What is the use of a span tag? Give an example.
2.12.
13. What is the use of an iframe tag?
2.13.
14. What are the entities in HTML?
2.14.
15. Is <!DOCTYPE html> tag an HTML tag?
2.15.
16. What are some standard lists used when designing a page?
2.16.
17. Explain some of the common lists to design a web page.
2.17.
18. What is the difference between the <link> and the <a> tag?
2.18.
19. How to create a nested webpage in HTML?
2.19.
20. To what values attribute can be set?
2.20.
21. What is the id attribute in HTML?
2.21.
22. How to indent list elements?
2.22.
23. What do you mean by alternative text?
2.23.
24. Is older HTML compatible with new browsers?
2.24.
25. Is a hyperlink only applicable to text?
3.
Advanced Level HTML Interview Questions and Answers
3.1.
26. Does a hyperlink only apply to text?
3.2.
27. In the middle of a list, how do you change the number type?
3.3.
28. What exactly are style sheets?
3.4.
29. How do you make the colorful text on a website?
3.5.
30. What is the benefit of grouping many checkboxes together?
3.6.
31. What exactly are applets?
3.7.
32. Is it possible to customize the color of the table borders?
3.8.
33. How do you make a link that, when clicked, takes you to another web page?
3.9.
34. Is it possible for a single text link to point to two different web pages?
3.10.
35. What is the distinction between the directory, menu, and unordered lists?
3.11.
36. Is it possible to modify the color of the bullets?
3.12.
37. What is the connection between border and rule attributes?
3.13.
38. Is there any chance that the text will appear outside of the browser?
3.14.
39. What distinguishes active links from regular links?
3.15.
40. Do style sheets impose a restriction on the number of additional style definitions that can be inserted between the brackets?
3.16.
41. What is the hierarchy that is followed in stylesheets?
3.17.
42. What happens if the external CSS file is opened in a browser?
3.18.
43. What if the list-style-type property is applied to a non-list element, such as a paragraph?
3.19.
44. When is the use of frames appropriate?
3.20.
45. What exactly is the Application Cache?
3.21.
46. What are the applications of the Application cache?
3.22.
47. What is the distinction between progress and a meter tag?
3.23.
48. What is the significance of the details and summary tags?
3.24.
49. What is the difference between the "id" and "class" attributes in HTML?
3.25.
50. What is the purpose of the "alt" attribute in an image tag in HTML?
3.26.
51. How do you create a hyperlink in HTML?
3.27.
52. What is HTML used for?
3.28.
53. What are the 4 basic tags of HTML?
3.29.
54. What are the 5 basic parts of HTML?
3.30.
55. What are the 3 main elements of HTML?The three main elements of HTML are:
4.
HTML5 Interview Questions and Answers
4.1.
57. What is HTML5?
4.2.
58. What is meant by HTML Entities?
4.3.
59. Do HTML tags and elements refer to the same entities?
4.4.
60. What is meant by ‘class’ attribute in HTML?
4.5.
61. What is multipart form data in HTML?
4.6.
62. What are tags in HTML5?
4.7.
63. List some new tags in HTML5.
4.8.
64. What are void tags in HTML5?
4.9.
65. What are the attributes in HTML5?
4.10.
66. How many tags were removed in HTML5?
5.
Conclusion
Last Updated: Jul 4, 2024
Easy

HTML Interview Questions

Author Rinki Deka
0 upvote
Master Python: Predicting weather forecasts
Speaker
Ashwin Goyal
Product Manager @

HTML is the foundation of any web development interview. As a result, it is critical to have a solid understanding of this subject. But don't be concerned about any of it. Ninjas are here to help, and today we'll talk about top HTML interview questions.

html interview questions

What is HTML?

HTML (Hypertext Markup Language) is a programming language used to create documents and web pages on a web server. HTML is required for the development of any website, web application, or other application. As a result, experts with HTML development skills are in high demand. Now, let's talk about HTML interview questions.

A list of the top 50 most asked HTML interview questions and answers are given below.

HTML Interview Questions and Answers

1. What do you mean by Tags?

HTML tags are made up of three parts: an opening tag, content, and an ending tag. Some tags are not closed.
HTML documents comprise two components: tags and content
When a web browser scans an HTML document, it does so from top to bottom and from left to right. HTML tags are used to build HTML documents and display their features. Each HTML tag has a unique set of attributes.

2. Do all HTML tags have an end tag?

No, some HTML tags don't need a closing tag. For example: <image>, <br>, <input>, <hr>, <meta>, etc.

3. What do you mean by Image Maps?

You can use an image map to link to multiple web pages by using a single image. You can define shapes in photographs that will be used in image mapping.

4. What is formatting in HTML?

HTML formatting is formatting the text of a webpage to have a better look and feel. HTML uses different tags to make text bold, emphasized, underscored.

Also See, AEM Interview Questions

5. How many types of heading does HTML contain?

The HTML contains six different types of headings which are defined from <h1> to <h6> tags. Each type of heading tag displays a different text size. <h1> is the largest and <h6> is the smallest heading tag. 

For example:

<h1>This is Heading h1</h1>    
<h2>This is Heading h2</h2>    
<h3>This is Heading h3</h3>    
<h4>This is Heading h4</h4>    
<h5>This is Heading h5</h5>    
<h6>This is Heading h6</h6>

6. How to create a hyperlink in HTML?

The HTML provides an anchor tag <a> to create a hyperlink that links one page. These tags can appear as follows:

Unvisited - It is displayed, underlined, and blue.

  • Visited - It is shown, stressed, and purple.
  • Active - It is underlined and red.


Output:

8. Which HTML tag do we use to display the data in the tabular form?

We use the HTML table tag to show data in tabular form (row * column). It also handles the layout of the page, e.g., header section, navigation bar, body content, footer section. Below is the list of tags used while depicting the data in the tabular form:

  • <table> - It represents a table.
  • <tr> - It represents a row in a table.
  • <th> - It represents a header cell in a table.
  • <td> - It represents a cell in a table.
  • <caption> - It represents the table caption.
  • <colgroup> - It defines a group of one or more columns in a table for formatting.
  • <col> - We use it with <colgroup> element to specify column properties for each column.
  • <tbody> - We use it to group the body content in a table.
  • <thead> - We use it to group the header content in a table.
  • <tfooter> - We use it to group the footer content in a table.

9. What is the significance of the head and the body tag?

The head tag is used to define the information regarding the document, whereas the body tag is used to describe the actual content or the body of the document. 

10. What is the difference between HTML tags and elements?

HTML elements correspond to the browser to render text. When we enclose the elements by brackets <>, they form an HTML tag. Most of the time, tags are in a pair and hold content.

11. What are empty elements?

An HTML element with no content are called empty elements. For example: <br>, <hr> etc.

12. What is the use of a span tag? Give an example.

We use the span tag for the following things:

  • For adding color to text
  • For adding background on text
  • Highlight any color text

Example:

<p>  
<span style="color:#ffffff;">  
On this page we use span.  
</span>  
</p> 

13. What is the use of an iframe tag?

We use an iframe to display a web page within a web page.

Syntax:

<iframe src=" ... "></iframe>  

Example:

<iframe src="iframe.html" width="400px" height="400px"</iframe>

14. What are the entities in HTML?

We use the HTML character entities to replace reserved characters in HTML. You can also replace characters not present on your keyboard with entities. We replace these characters because some characters are reserved in HTML.

15. Is <!DOCTYPE html> tag an HTML tag?

No, the <!DOCTYPE> declaration is not an HTML tag. We use <!DOCTYPE> to instruct the web browser about the HTML page.

16. What are some standard lists used when designing a page?

We use many standard lists to design a page. We can choose any or a combination of the following types of list:

  • Ordered list - It list displays elements in a numbered format. It is represented by <ol> tag.
  • Unordered list - It displays elements in bullet point format. It is represented by <ul> tag.
  • Definition list - It displays elements like in a dictionary. we use <dl>, <dt> and <dd> tags to define description list.

Output:

This is an Ordered List
1. Item 1
2. Item 2
3. Item 3
This is an Unordered List
• Item 1
• Item 2
• Item 3
This is an Unstyled List
Item 1
Item 2
Item 3
This is an Inline List
Item 1  Item 2  Item 3
This is a Definition List
Description Lists: This type of list is perfect for defining something
Some elusive words: This is the definition of that word
                    Some other useful text could be written here
                    
Truncated item ge…. : This can be useful when space is scarce

17. Explain some of the common lists to design a web page.

The common lists to design a web page include:

  • Ordered list
  • Directory list
  • Menu list
  • Unordered list
  • Definition list

18. What is the difference between the <link> and the <a> tag?

The <link> tag is used to define a link between the given URL and the HTML document, whereas the <a> tag is used to add a hyperlink to the webpage.

19. How to create a nested webpage in HTML?

We use the HTML iframe tag to display a nested webpage. In other words, it describes a webpage within a webpage. The HTML <iframe> tag portrays an inline frame.

For example:

<!DOCTYPE html>
<html>
<body>    
<h1>HTML Iframes example</h1> 
<p>Use the height & width attributes to specify the size of the iframe:</p>    
<iframe src="..." height="400" width="500"></iframe>    
</body>    
</html>

20. To what values attribute can be set?

Only predefined values can be assigned to some attribute values. Other characteristics can accept any integer value representing the number of pixels in size.

You can also check, Operating System Interview Questions

21. What is the id attribute in HTML?

The id attribute performs the same function as the class attribute. It is used to add an id to an element. Like the class attribute, the id attribute is also generally associated with the stylesheets.

22. How to indent list elements?

By utilizing indents, you can keep the list of components straight. If you indent each sub nested list deeper than the parent list that includes it, you can see the various lists and the components that they contain at a glance. 

23. What do you mean by alternative text?

When using picture maps, determining which hotspots belong to which links can quickly become complex and challenging. You can use alternative text to add descriptive information to each hotspot connection.

24. Is older HTML compatible with new browsers?

Yes, older HTML files are HTML standard compliant. Most older files are compatible with newer browsers, though some functions may not be available.

25. Is a hyperlink only applicable to text?

No, hyperlinks can be used in both text and graphics. That is, you can turn an image into a link that will take viewers to another page when clicked. a href=" ">.../a> tag combinations should be used to surround the image.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Advanced Level HTML Interview Questions and Answers

26. Does a hyperlink only apply to text?

No, you can use hyperlinks on both text and images. The HTML anchor tag <a> defines a hyperlink that connects one page. The "href" attribute is the most crucial attribute of the HTML anchor tag.

Syntax

<a href = " ... "> Link Text </a> 

27. In the middle of a list, how do you change the number type?

The type and value characteristics are included in the li> tag. Any list item's numbering type can be changed using the type property. The value attribute has the ability to modify the number index.

28. What exactly are style sheets?

Style sheets allow you to create style templates that are uniform, portable, and well-defined. These templates can be linked to a variety of online sites, making it simple to maintain and change the look and feel of the entire site's web pages. 

29. How do you make the colorful text on a website?

Use the tag <font color=”color”>…</font>. to create text with different colours. /font> tags for each character to which color should be applied. This tag combination can be used as many times as needed to surround a single character or an entire word. 

30. What is the benefit of grouping many checkboxes together?

Although checkboxes have no effect on one another, putting them together helps to organize them. Checkbox buttons can be given a name and are not required to be part of a group. A single web page can contain a variety of checkbox groups. 

31. What exactly are applets?

Applets are small programs that can be embedded within web pages to accomplish specific tasks such as computations, animations, and data processing. The Java programming language is used to create applets. 

32. Is it possible to customize the color of the table borders?

Style sheets can be used to set a border color, but the border colors for a table that is not styled using style sheets will be the same as the text color. 

33. How do you make a link that, when clicked, takes you to another web page?

The href tag is used to construct hyperlinks or links that connect to another web page. The usual format is as follows:  <a href=”site”>text</a>. Replace "site" with the actual URL of the page that should be linked when the text is clicked. 

34. Is it possible for a single text link to point to two different web pages?

No. The <a> tag can only accept a single href attribute that points to a single web page. 

35. What is the distinction between the directory, menu, and unordered lists?

The main difference is that the directory and menu listings do not have bullet-style elements. 

36. Is it possible to modify the color of the bullets?

The color of the bullet is always the same as the color of the first character in the list item. If you surround the <li> and the first character with a set of <font> tags with the color property set, the bullet color and, first character will be different colors than the text.

37. What is the connection between border and rule attributes?

If the border property is set to a nonzero value, default cell boundaries with a thickness of one pixel are automatically placed between cells. Similarly, if the rules property is added to the table> tag but the border attribute is not provided, a default 1-pixel border emerges.

38. Is there any chance that the text will appear outside of the browser?

By default, the text is wrapped to fit the browser window. If the text is included within a table cell with a fixed width, it may extend outside the browser window. 

Click on the following link to read further: Javascript Interview Questions and Answers

39. What distinguishes active links from regular links?

Blue is the default color for normal and active links. When the mouse pointer is over a link, some browsers recognize it as active; others recognize it as active when the link has the focus. Those that do not have the mouse cursor over the link are regarded as normal. 

40. Do style sheets impose a restriction on the number of additional style definitions that can be inserted between the brackets?

The number of style definitions that can be inserted within the brackets for a particular selection is not limited by style sheets. However, each new style specification must be separated from the others by a semicolon symbol. 

41. What is the hierarchy that is followed in stylesheets?

If a single selector contains three alternative style declarations, the one closest to the actual tag takes precedence. Inline style takes precedence over embedded style sheets, which in turn take precedence over external style sheets. 

42. What happens if the external CSS file is opened in a browser?

It fails since the extension is different. The only way to use an external CSS file is to use the <link/> tag within another HTML document. 

43. What if the list-style-type property is applied to a non-list element, such as a paragraph?

When the list-style-type property is applied to a non-list element, it has no effect on the paragraph. 

44. When is the use of frames appropriate?

Frames make it much easier to navigate through a website. If the primary site links are in a frame that displays at the top or along the edge of the browser, the information for those links can be displayed in the browser window's remaining space. 

45. What exactly is the Application Cache?

The term "Application Cache" refers to the caching of a web application. It is possible to access it without an internet connection. 

46. What are the applications of the Application cache?

Offline surfing - Web users can use the program even when they are not connected to the internet. 
Cached resources load more quickly.
Reduce server demand - The web browser will only download resources from the server that have been updated.

47. What is the distinction between progress and a meter tag?

The progress tag is only used to show task progress, but the meter tag is used to measure data within a specific range. 

48. What is the significance of the details and summary tags?

The details tag is used to add some extra information to a web page. It can be seen or hidden at any time. The summary tag is used with the details tag.

49. What is the difference between the "id" and "class" attributes in HTML?

The "id" attribute is used to uniquely identify a single element on a page, while the "class" attribute is used to group multiple elements together and apply styling or any functionality to them collectively.

50. What is the purpose of the "alt" attribute in an image tag in HTML?

The purpose of the “alt” attribute in HTML is that it is used for an alternative text description when the image is not displayed due to various reasons such as slow internet connectivity, etc. Also, it helps visually impaired users to understand what the image wants to tell with the help of screen readers.

51. How do you create a hyperlink in HTML?

We will use the anchor tag <a> and specify the URL of the webpage one wants to link to in the href attribute to create a hyperlink in HTML. For example: <a href="https://example.com">Link text</a> would create a hyperlink with the text "Link text" that, when clicked, would take the user to the webpage at the URL "https://example.com".

52. What is HTML used for?

HTML also known as Hypertext Markup Language is basically used for creating web pages and structuring them. It helps one describe the structure of the web page with only text-based content, including paragraphs, links, lists, images, etc. It is the first one taken while creating web pages or web applications.

53. What are the 4 basic tags of HTML?

<html>: It defines the beginning and the end of an HTML document.

<head>: It contains the metadata (it is used to specify page description, keywords or author name) of a webpage.

<title>: It defines the title of the HTML document. The title appears in the browser's title bar.

<body>: It contains the main body or content that is to be added to the HTML page such as text, images, or any other multimedia elements.

54. What are the 5 basic parts of HTML?

Document Type Declaration (<!DOCTYPE html>): It helps us define the version of HTML used

HTML tag (<html>): it defines the beginning and is the root tag that includes all the subsequent tags.

Head tag (<head>): It defines metadata which includes title, styles, author name, etc.

Body tag (<body>): It contains the main body or content that is to be added to the HTML page such as text, images, or any other multimedia elements.

Closing HTML tag (</html>): It is used to close the HTML document.

55. What are the 3 main elements of HTML?
The three main elements of HTML are:

Tags: it is used to define the purpose of a particular web page and to markup the HTML elements present in the body of HTML.

Attributes: it provides extra information on how the HTML elements should appear or behave.
Text Content: it helps one to display the content on the web page. It can be formatted by using HTML tags and attributes.

HTML5 Interview Questions and Answers

57. What is HTML5?

HyperText Markup Language 5(HTML5) is used to design web pages. A markup language is used to determine the text document within the tag, describing the structure of web pages. In contrast, we use HyperText to create a link between web pages. HTML5 is a combination of Markup and HyperText Language.

58. What is meant by HTML Entities?

HTML5 entities are special codes used for representing characters that have special meanings or they cannot be easily typed or displayed directly in HTML due to the conflicts with HTML tags. These entities are written with ampersand followed by a code, and then a semicolon. 

For example, the following entity code displays the ampersand symbol.

&amp;

59. Do HTML tags and elements refer to the same entities?

Tags are used for defining elements in HTML, they are not the same entities. Tags are simple text used for denoting the starting and ending of an HTML element.

For example, the '<p>' tag, defines the start of an HTML paragraph element, anything before the closing ‘</p>’ tag will be considered as the content of the paragraph element.

<p>This is a paragraph</p>

60. What is meant by ‘class’ attribute in HTML?

The class attribute is used for assigning one or more class names to an HTML element. The value of the class attribute is a space-separated list of class names. Unlike ids, a class name can be assigned to more than 1 element. They are used for styling HTML elements with CSS and selecting DOM nodes with JavaScript.

61. What is multipart form data in HTML?

In HTML5, “multipart/form-data” is an encoding type used for forms when you want to upload files. When a form is submitted with the multipart/form-data encoding type, the form data is divided into multiple parts, allowing files to be uploaded to your backend services.

62. What are tags in HTML5?

Tags in HTML5 are used to define the structure and content of a web page. They are enclosed in angle brackets (< >) and come in pairs, with an opening tag and a closing tag. For example, the <p> tag is used to define a paragraph, and the <img> tag is used to define an image.

63. List some new tags in HTML5.

New list of tags are added in HTML5 to provide document a better structure. primary component of HTML. A tag mainly consists of three components,

  • <article>
     
  • <aside>
     
  • <mark>
     
  • <video>
     
  • <svg>
     
  • <rt>

64. What are void tags in HTML5?

This is one of the most commonly asked and the easiest HTML5 Interview Questions. The HTML tags that don’t require a closing or ending tag are known as void tags, for example, <br>, <hr>, <img>, etc.

65. What are the attributes in HTML5?

Attributes are additional conditions added to a tag to add more specific instructions to the content. HTML5 attributes are case insensitive and may be written in all uppercase or mixed case. For example, <div class = "example">...</div>, which illustrates how to mark up a div element with an attribute named class using a value of "example".

Also see, Azure Data Engineer Interview Questions

66. How many tags were removed in HTML5?

The list of the tags that are removed completely in HTML5 include:

  • <frame>
     
  • <frameset>
     
  • <noframes>
     
  • <big>
     
  • <basefront>
     
  • <applet>
     
  • <center>
     
  • <bigcenter>
     
  • <acronym>
     
  • <basefont>
     
  • <dir>
     
  • <tt>
     
  • <font>
     
  • <strike>

 

Must Read Web Developer Interview Questions

Conclusion

In this article, we have extensively discussed the top HTML interview questions. We hope that this blog has helped you enhance your knowledge of HTML interview questions. For further reading on HTML, refer to this, Also check out some of our amazing articles such as HTML 5, Data Structures and Algorithms, Programming Fundamentals, Web Technologies, and many more.

Recommended Readings:

 

Previous article
Hibernate Interview Questions
Next article
Top HTML5 Interview Questions and Answers (2023)
Live masterclass