Top 250 HTML Interview Questions and Answers
Updated 16 Jul 2025

Asked in Cognizant

Q. How do you get the count of all text boxes on a webpage?
Use Selenium WebDriver to find and count all text boxes on a web page.
Use Selenium WebDriver to locate all text boxes on the web page
Use findElements method with input tag and type attribute as text to find all text boxes
Get the size of the list of e...read more

Asked in idoow

Q. How is JavaScript used in HTML?
JavaScript in HTML is a scripting language used to add interactivity and dynamic content to web pages.
JavaScript is a programming language that can be embedded directly into HTML code
It allows for interactive elements like pop-up alerts, form validat...read more
Asked in Entro Labs IT Solutions

Q. What is an embedded style sheet?
Embedded style sheet is CSS code written within the <style> tag in the head section of an HTML document.
Embedded style sheet is used to define styles for a single HTML document.
It is written within the <style> tag in the head section of the HTML docu...read more
Asked in Imaginnovate

Q. How do we link external CSS and JS files to HTML?
External CSS and JS files can be linked to HTML using the <link> and <script> tags respectively.
Use the <link> tag with the 'rel' attribute set to 'stylesheet' to link external CSS files.
Use the <script> tag with the 'src' attribute to link external ...read more

Asked in The Sparks Foundation

Q. In HTML, is span a tag?
Yes, span is a tag in HTML used to apply styles to inline elements.
Span is an inline element used to apply styles to a specific section of text or content.
It does not add any extra space or line breaks.
Example: <span style='color: red;'>This text wil...read more

Asked in Entrata and 9 others

Q. What is the difference between sessions and cookies?
Sessions store data on the server side while cookies store data on the client side.
Sessions store data on the server side, usually in a temporary directory or database
Cookies store data on the client side, in the form of key-value pairs
Sessions are m...read more

Asked in Webskitters

Q. What is the difference between and tags?
The <b> tag is used to bold text, while the <strong> tag is used to emphasize text with stronger importance.
The <b> tag is used for stylistic purposes, while the <strong> tag is used for semantic purposes.
The <b> tag is purely presentational, while t...read more

Asked in Atos

Q. How many windows can be maintained under one page?
The number of windows that can be maintained under one page depends on the system's capabilities and resources.
The number of windows that can be maintained may vary based on the operating system and hardware specifications.
Factors such as memory, pro...read more

Asked in Infosys

Q. How can JavaScript be embedded in CSS?
JavaScript cannot be embedded directly in CSS, but can be used in conjunction with CSS to manipulate styles dynamically.
JavaScript can be used to dynamically change CSS properties of elements on a webpage
This can be achieved by selecting the element ...read more

Asked in Axioned

Q. What is the difference between a block element and an inline element?
Block elements take up the full width available, while inline elements only take up as much width as necessary.
Block elements start on a new line and stack vertically, while inline elements flow within the text.
Block elements can have margins and pad...read more
HTML Jobs



Asked in EBC Publishing

Q. What are the differences between XML and HTML?
XML is used for storing and transporting data, while HTML is used for displaying data on web pages.
XML is extensible and allows users to define their own tags, while HTML has predefined tags for structuring content.
XML focuses on data and its structu...read more
Asked in Icancerhelp India

Q. What is the use of meta tags in HTML?
Meta tags in HTML are 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, and description.
Meta tags can also be use...read more

Asked in Houzeo

Q. What are semantic and meta tags in a webpage?
Semantic and meta tags in a webpage help search engines understand the content and structure of the page.
Semantic tags provide meaning to the content, such as <header>, <footer>, <article>, <section>.
Meta tags provide metadata about the webpage, such...read more

Asked in Innostax Software Labs

Q. What is the tag for an anchor link in HTML?
The tag for Anchor link in HTML is <a>
The anchor tag is used to create hyperlinks in HTML
The href attribute is used to specify the URL of the page the link goes to
Text between the opening and closing <a> tags is the clickable text for the link

Asked in HARMAN

Q. How do you add an image using the image tag?
To add an image in an image tag, use the 'src' attribute with the URL of the image.
Use the <img> tag in HTML
Set the 'src' attribute to the URL of the image
Optionally, add 'alt' attribute for accessibility

Asked in JPMorgan Chase & Co.

New tags in Media Elements in HTML5 include <audio> and <video>.
<audio> tag for audio content
<video> tag for video content
Attributes like controls, autoplay, loop, etc. can be used with these tags

Asked in SAMCO Securities

Q. If both id and class are applied to an element, which style will take precedence?
The style of the id will apply first before the style of the class.
IDs have higher specificity than classes, so the style of the id will take precedence over the style of the class.
If both id and class have conflicting styles, the style of the id wil...read more

Asked in MAQ Software

Q. What is the difference between span and div tags?
Span is an inline element used for styling small portions of text, while div is a block-level element used for grouping and styling larger sections of content.
Span is an inline element, div is a block-level element
Span is used for styling small porti...read more

Asked in Cogniter Technologies

Q. What is the span tag in HTML?
The span tag in HTML is used to group inline elements and apply styles to them.
Used to group inline elements together
Does not add any extra space or line breaks
Commonly used for styling purposes

Asked in MagicBricks

Q. Tell me the difference between Semantic and Nonsemantic elements
Semantic elements provide meaning to the content, while nonsemantic elements are used for styling purposes only.
Semantic elements have a clear meaning and purpose in the code, making it easier for search engines and screen readers to understand the c...read more

Asked in CitiusTech

Q. What different HTML attributes have you used so far?
I have used various HTML attributes such as id, class, src, href, alt, style, etc.
id
class
src
href
alt
style
Asked in CyberSafex and 2 others

Q. What is the difference between span and div?
Span is an inline element used for styling small portions of text, while div is a block-level element used for grouping and styling larger sections of content.
Span is an inline element, while div is a block-level element
Span is used for styling small...read more

Asked in SDAD Technology

Q. What are heading tags?
Heading tags are HTML elements used to define headings and subheadings on a webpage.
Heading tags range from <h1> to <h6>, with <h1> being the most important and <h6> the least important.
Heading tags help search engines understand the structure and co...read more

Asked in Webskitters

Q. What is the difference between DIV and SPAN tags?
DIV is a block-level element while SPAN is an inline element used for styling and grouping content.
DIV is a block-level element, meaning it takes up the full width available and starts on a new line.
SPAN is an inline element, meaning it only takes up...read more

Asked in TCS

Q. How can you display an IP address in HTML?
Use JavaScript to display the user's IP address on an HTML page.
Use JavaScript to fetch the user's IP address
Create a HTML element to display the IP address
Insert the fetched IP address into the HTML element

Asked in PurpleTalk and 2 others

Q. What is the Marquee tag?
The Marquee tag is an HTML element used to create scrolling text or images on a web page.
The <marquee> tag is used to create a scrolling effect horizontally or vertically.
It has attributes like behavior, direction, scrollamount, scrolldelay, etc.
Exam...read more

Asked in Indegene

Q. Why do you use doctype in HTML?
Doctype in HTML specifies the version of HTML being used and helps browsers render web pages correctly.
Specifies the version of HTML being used
Helps browsers render web pages correctly
Prevents browsers from entering quirks mode

Asked in Moris Media

Q. What is the purpose of an hreflang tag?
An hreflang tag is used to indicate to search engines the language and geographical targeting of a webpage.
Helps search engines understand the language and geographical targeting of a webpage
Improves international SEO by serving the correct language ...read more

Asked in Symphony Talent

Q. What does DOCTYPE mean?
DOCTYPE is an instruction to the web browser about the version of HTML being used in the document.
DOCTYPE declaration is placed at the very beginning of an HTML document, before the <html> tag.
It helps the browser to render the web page correctly by ...read more
Asked in Kiaan Technology and 12 others

Q. What is the Box Model?
Box Model is a concept in CSS where every element is treated as a box with content, padding, border, and margin.
Box Model consists of content, padding, border, and margin.
Content is the actual content of the box.
Padding is the space between the conte...read more
Top Interview Questions for Related Skills
Interview Experiences of Popular Companies










Interview Questions of HTML Related Designations



Reviews
Interviews
Salaries
Users

