0% found this document useful (0 votes)
7 views2 pages

Essential HTML Interview Q&A Guide

The document provides a list of HTML interview questions and answers covering fundamental concepts such as the definition of HTML, differences between HTML and XHTML, semantic tags, and various HTML elements. It explains the purpose of tags like <head>, <body>, <form>, and the differences between input types, list types, and methods of data submission. Additionally, it addresses accessibility features and the use of JavaScript within HTML.

Uploaded by

1205.aakash
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Essential HTML Interview Q&A Guide

The document provides a list of HTML interview questions and answers covering fundamental concepts such as the definition of HTML, differences between HTML and XHTML, semantic tags, and various HTML elements. It explains the purpose of tags like <head>, <body>, <form>, and the differences between input types, list types, and methods of data submission. Additionally, it addresses accessibility features and the use of JavaScript within HTML.

Uploaded by

1205.aakash
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

HTML Interview Questions & Answers

1. What is HTML?
Answer: HTML is a language used to create web pages. It helps you structure content using tags
like headings, paragraphs, images, and links.

2. Difference between HTML and XHTML?


Answer: XHTML is stricter than HTML. In XHTML, all tags must be closed, lowercase, and properly
nested. HTML is more flexible.

3. What are semantic tags?


Answer: Semantic tags clearly describe their meaning to both browser and developer. Examples:
<header>, <footer>, <article>, <nav>.

4. Difference between <div> and <span>?


Answer: <div> is a block element used for large sections; <span> is inline used for small text or
styling within a line.

5. Purpose of <head> and <body>?


Answer: <head> contains meta info, title, and links. <body> contains the content visible to the user.

6. What is the <meta> tag used for?


Answer: Provides information like page charset, description, and viewport for mobile
responsiveness.

7. Difference between <section> and <article>?


Answer: <section> groups related content. <article> is for self-contained content like a blog post.

8. Difference between <ul>, <ol>, and <dl>?


Answer: <ul> = unordered list, <ol> = ordered list, <dl> = description list.

9. What is a <form> and its attributes?


Answer: A form collects user input. Attributes include action (where to send data), method (GET or
POST), and enctype (for file uploads).

10. Difference between GET and POST?


Answer: GET sends data in the URL, visible to users. POST sends data in the request body, more
secure and hidden.

11. HTML5 input types?


Answer: Examples include text, number, email, password, date, color, url.
12. Purpose of alt in <img>?
Answer: Provides alternative text if an image fails to load. Helps screen readers for accessibility.

13. Difference between <iframe> and <embed>?


Answer: <iframe embeds another HTML page. <embed embeds media like video, audio, or PDF
files.

14. Difference between <strong> and <b>?


Answer: <strong> indicates importance (semantic). <b> is just visual bold text.

15. Difference between <em> and <i>?


Answer: <em> emphasizes text (semantic). <i> italicizes text visually.

16. What are HTML entities?


Answer: Special codes to display reserved characters, like &lt; for <, &gt; for >, &nbsp; for space.

17. Inline, block, inline-block difference?


Answer: Inline stays in line, block starts on a new line, inline-block stays in line but can have width
and height.

18. What is <canvas> used for?


Answer: Used to draw graphics, charts, or animations with JavaScript.

19. How to include JavaScript in HTML?


Answer: Use <script> tag. Inline: <script>alert('Hi')</script>, External: <script src='[Link]'></script>.

20. What are data-* attributes?


Answer: Custom attributes to store extra info, e.g., <div data-id='123'></div>. Can be accessed in
JS.

You might also like