Top 250 HTML Interview Questions and Answers
Updated 1 Jul 2025

Asked in TCS

Q. Write an HTML program for form validation.
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.

Asked in Swaliya Softech

Q. What is the difference between XHTML and HTML?
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

Asked in Maxtra Technologies

Q. What is the difference between an XML and HTML sitemap?
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

Q. What is the head tag in HTML?
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

Asked in RipenApps Technologies

Q. What are inline and block elements?
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

Q. What are the benefits of using semantic HTML?
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

Asked in TIAA Global Business Services

Q. Design an HTML page with a button that prints text when clicked.
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

Q. How do you open a link in a new page?
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

Q. What is an HTML meta tag?
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

Asked in SMC Global Securities

Q. What is the difference between a link button and a hyperlink?
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




Asked in Etech Global Services

Q. In HTML, what is the difference between 'display: none' and 'visibility: hidden' when defining color?
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

Q. What are HTML comments?
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

Q. What is meant by Aria Label?
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

Q. What is the difference between HTML and XHTML?
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
Asked in Entro Labs IT Solutions

Q. How many types of headings does an HTML contain?
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

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

Asked in Tata Projects

Q. What is web page html viewer
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

Q. How can you include external CSS and JavaScript files in an HTML document?
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

Asked in AppInventiv Technologies

Q. Under which HTML tag is a backlink created?
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>

Asked in Photon Interactive

Q. Tell me about five new features of HTML5.
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

Q. How do you create an HTML file?
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

Q. How would you change the format of all the phone numbers in 1000 static HTML pages?
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

Asked in Daboya Technologies

Q. Please explain the different types of layouts in HTML.
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

Q. What is the difference between URL mode and HTML mode?
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

Q. Which version of HTML is currently used, and why?
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
Asked in Entro Labs IT Solutions

Q. How do you insert the copyright symbol in an HTML file?
Use the HTML entity © to insert the copyright symbol in an HTML file.
Use the HTML entity © to represent the copyright symbol in HTML.
Place © where you want the copyright symbol to appear in the HTML file.

Asked in SwaPra Technologies

Q. What are the differences between HTML4 and HTML5?
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

Q. What is the purpose of HTML?
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

Q. Write a program in HTML.
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

Q. Where should the description be added in HTML?
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
Top Interview Questions for Related Skills
Interview Experiences of Popular Companies










Interview Questions of HTML Related Designations



Reviews
Interviews
Salaries
Users

