Top 250 HTML Interview Questions and Answers

Updated 1 Jul 2025

Asked in TCS

2w ago

Q. Write an HTML program for form validation.

Ans.

HTML program for form validation

  • Use HTML form elements like input, select, textarea

  • Use JavaScript for validation

  • Check for required fields, email format, password strength, etc.

5d ago

Q. What is the difference between XHTML and HTML?

Ans.

XHTML is a stricter and cleaner version of HTML, following XML rules.

  • XHTML is stricter in syntax and requires well-formed documents.

  • XHTML tags must be properly nested and closed.

  • XHTML is case-sensitive.

  • HTML is more forgiving in terms of syntax errors...read more

1d ago

Q. What is the difference between an XML and HTML sitemap?

Ans.

XML site maps are used by search engines to understand the structure of a website, while HTML site maps are designed for human users to navigate the site.

  • XML site maps are primarily for search engines to crawl and index website content

  • HTML site maps ...read more

Asked in TCS

2w ago

Q. What is the head tag in HTML?

Ans.

Head tag in HTML is used to define the header section of a webpage, containing metadata, links to external resources, and scripts.

  • Head tag is placed between the opening <head> and closing </head> tags in the HTML document.

  • It contains metadata such as...read more

Are these interview questions helpful?

Q. What are inline and block elements?

Ans.

Inline and block elements are two types of HTML elements with different default behaviors in terms of layout and positioning.

  • Inline elements flow in the document from left to right, and only take up as much width as necessary. Examples include <span>...read more

Asked in Convosight

2w ago

Q. What are the benefits of using semantic HTML?

Ans.

Semantic HTML provides structure and meaning to content, improving accessibility, SEO, and maintainability.

  • Improves accessibility for screen readers and other assistive technologies

  • Enhances SEO by providing search engines with better understanding of...read more

Share interview questions and help millions of jobseekers 🌟
man with laptop

Q. Design an HTML page with a button that prints text when clicked.

Ans.

HTML page with a button to print text when clicked

  • Create a button element in HTML

  • Add an onclick event to the button that calls a JavaScript function

  • In the JavaScript function, use the window.print() method to print text

Asked in Goitdev

1w ago

Q. How do you open a link in a new page?

Ans.

To open a link in a new page, use the target attribute with the value '_blank'.

  • Add the target attribute to the anchor tag (<a>) with the value '_blank'.

  • Example: <a href='https://www.example.com' target='_blank'>Link</a>

Asked in FoodVybe

2w ago

Q. What is an HTML meta tag?

Ans.

HTML meta tag is used to provide metadata about the HTML document.

  • Meta tags are placed in the head section of an HTML document.

  • They provide information such as character set, viewport settings, keywords, description, etc.

  • Example: <meta charset='UTF-8...read more

1w ago

Q. What is the difference between a link button and a hyperlink?

Ans.

Link button is a button that looks like a hyperlink but behaves like a button, while a hyperlink is a clickable text or image that redirects to another page.

  • Link button is styled like a button and typically used for actions like submitting a form or ...read more

HTML Jobs

Muthoot Fincorp Ltd logo
Senior Software Engineer/ DotNet_TVM 5-10 years
Muthoot Fincorp Ltd
4.5
Thiruvananthapuram
Muthoot Fincorp Ltd logo
QUALITY ANALYST 2-7 years
Muthoot Fincorp Ltd
4.5
Chennai
Muthoot Fincorp Ltd logo
Associate Principal Engineer 7-10 years
Muthoot Fincorp Ltd
4.5
Bangalore / Bengaluru
2w ago

Q. In HTML, what is the difference between 'display: none' and 'visibility: hidden' when defining color?

Ans.

In HTML, display none completely removes an element from the page layout, while hidden hides the element but still takes up space.

  • display none removes the element from the layout and it is not visible on the page

  • hidden hides the element but it still ...read more

Asked in PurpleTalk

6d ago

Q. What are HTML comments?

Ans.

HTML comments are used to add notes to the code that are not displayed on the web page.

  • Comments in HTML are enclosed in <!-- and -->

  • Comments are used to explain the code, make notes, or temporarily disable code

  • Comments are not displayed on the web pa...read more

Asked in HSBC Group

2d ago

Q. What is meant by Aria Label?

Ans.

Aria Label is a way to provide a text alternative for non-text content such as images or buttons for screen readers.

  • Aria Label is used in web development to improve accessibility for users with disabilities.

  • It is added to HTML elements to provide a l...read more

Asked in Shell

1w ago

Q. What is the difference between HTML and XHTML?

Ans.

HTML is a markup language for creating web pages, while XHTML is a stricter version of HTML that follows XML rules.

  • HTML stands for HyperText Markup Language and is used for creating web pages.

  • XHTML stands for eXtensible HyperText Markup Language and ...read more

Q. How many types of headings does an HTML contain?

Ans.

HTML contains six types of headings, from h1 to h6.

  • HTML contains six levels of headings: h1, h2, h3, h4, h5, and h6.

  • Each heading tag represents a different level of importance and hierarchy in the content.

  • The h1 tag is the highest level of heading an...read more

Asked in Amdocs

1w ago
Q. What are media elements in HTML?
Ans.

Media elements in HTML are used to embed audio and video content on a webpage.

  • Media elements include <audio> and <video> tags in HTML.

  • They allow for the playback of audio and video files directly on a webpage.

  • Attributes like src, controls, autoplay, ...read more

2d ago

Q. What is web page html viewer

Ans.

A web page HTML viewer is a tool or software that allows users to view the HTML code of a web page in a structured and readable format.

  • Web page HTML viewer helps users to understand the structure and content of a web page by displaying the underlying...read more

Asked in AmbitionBox

1w ago

Q. How can you include external CSS and JavaScript files in an HTML document?

Ans.

External CSS and JavaScript files can be included in an HTML document using the <link> and <script> tags.

  • Use the <link> tag with the 'rel' attribute set to 'stylesheet' to include external CSS files.

  • Use the <script> tag with the 'src' attribute to in...read more

Q. Under which HTML tag is a backlink created?

Ans.

Backlinks are created under the <a> HTML tag.

  • Backlinks are created using the <a> tag in HTML.

  • The href attribute within the <a> tag specifies the URL of the page the link goes to.

  • Example: <a href='https://www.example.com'>Example</a>

1w ago

Q. Tell me about five new features of HTML5.

Ans.

HTML 5 introduced several new features to enhance web development.

  • 1. Canvas element for drawing graphics on the fly

  • 2. Video and audio elements for embedding media content

  • 3. Local storage capabilities for storing data on the client side

  • 4. New form inp...read more

Asked in Google

1w ago

Q. How do you create an HTML file?

Ans.

To create a HTML file, you can use a text editor to write the code and save it with a .html extension.

  • Open a text editor like Notepad, Sublime Text, or Visual Studio Code

  • Write your HTML code including tags like <html>, <head>, <title>, <body>

  • Save the...read more

Asked in Google

2w ago

Q. How would you change the format of all the phone numbers in 1000 static HTML pages?

Ans.

Use a script to iterate through each HTML page, locate phone numbers, and update their format.

  • Write a script using a programming language like Python or JavaScript to iterate through each HTML page

  • Use regular expressions to locate phone numbers in th...read more

2w ago

Q. Please explain the different types of layouts in HTML.

Ans.

Different types of layout in HTML include fixed, fluid, responsive, and grid layouts.

  • Fixed layout: Elements are set to a specific width and do not change based on screen size.

  • Fluid layout: Elements are set as percentages of the viewport width, allowi...read more

Asked in TCS

2w ago

Q. What is the difference between URL mode and HTML mode?

Ans.

URL mode is used to test the performance of a specific URL, while HTML mode is used to test the performance of the entire HTML page.

  • URL mode focuses on a single URL, measuring response time and other metrics specific to that URL.

  • HTML mode simulates u...read more

Asked in HCLTech

1w ago

Q. Which version of HTML is currently used, and why?

Ans.

The latest version of HTML is HTML5, which is widely adopted for its improved functionality and features.

  • HTML5 is the current version of HTML being used

  • It offers new features like <video>, <audio>, <canvas>, and <svg> elements

  • HTML5 provides better su...read more

Q. How do you insert the copyright symbol in an HTML file?

Ans.

Use the HTML entity &#169; to insert the copyright symbol in an HTML file.

  • Use the HTML entity &#169; to represent the copyright symbol in HTML.

  • Place &#169; where you want the copyright symbol to appear in the HTML file.

4d ago

Q. What are the differences between HTML4 and HTML5?

Ans.

HTML5 introduced new features like semantic elements, audio/video support, canvas element, and improved form controls.

  • HTML5 introduced new semantic elements like <header>, <footer>, <nav>, <article>, <section> for better structure and SEO.

  • HTML5 added...read more

Asked in AmbitionBox and 3 others

1w ago

Q. What is the purpose of HTML?

Ans.

HTML is a markup language used to create the structure of web pages.

  • HTML stands for HyperText Markup Language.

  • It is used to create the structure of web pages by using tags.

  • Tags are enclosed in angle brackets, like <tag>.

  • HTML elements are used to defi...read more

Asked in TCS

2d ago

Q. Write a program in HTML.

Ans.

HTML program to display a simple webpage

  • Use HTML tags like <html>, <head>, <title>, <body>, <h1>, <p>

  • Include content within tags to display on the webpage

  • Save the file with .html extension and open in a web browser

Asked in Webdreams

3d ago

Q. Where should the description be added in HTML?

Ans.

Description in HTML can be added using the meta tag within the head section of the document.

  • Add the description within the <head> section of the HTML document.

  • Use the <meta> tag with the attribute name='description' and content='your description here...read more

Previous
1
2
3
4
5
6
7
Next

Interview Experiences of Popular Companies

TCS Logo
3.6
 • 11.1k Interviews
Accenture Logo
3.8
 • 8.6k Interviews
Infosys Logo
3.6
 • 7.9k Interviews
Wipro Logo
3.7
 • 6.1k Interviews
Cognizant Logo
3.7
 • 5.9k Interviews
Amazon Logo
4.0
 • 5.4k Interviews
Capgemini Logo
3.7
 • 5.1k Interviews
HCLTech Logo
3.5
 • 4.1k Interviews
LTIMindtree Logo
3.7
 • 3k Interviews
AmbitionBox Logo
4.8
 • 148 Interviews
View all
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories
HTML Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 Lakh+

Reviews

10L+

Interviews

4 Crore+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits