==================================================
HTML Interview Questions and Answers
==================================================
Table of Contents:
------------------
1. What is HTML?
2. What are HTML tags?
3. What is the difference between HTML and HTML5?
4. What are void elements in HTML?
5. What is the DOCTYPE declaration?
6. What is the difference between <div> and <span>?
7. What is the purpose of the <meta> tag?
8. What are semantic elements in HTML?
9. What is the difference between <link> and <a> tags?
10. What is the difference between id and class attributes?
...
50. What is the purpose of the <base> tag?
==================================================
### 1. What is HTML?
HTML (HyperText Markup Language) is the standard language used to create and design
web pages. It structures web content with elements like headings, paragraphs,
images, and links.
--------------------------------------------------
### 2. What are HTML tags?
HTML tags are keywords enclosed in angle brackets (<>) that define elements in an
HTML document. Example: <p> for paragraphs, <a> for links.
--------------------------------------------------
### 3. What is the difference between HTML and HTML5?
HTML5 is the latest version of HTML with new features like audio, video, canvas,
and improved support for mobile devices and accessibility.
--------------------------------------------------
### 4. What are void elements in HTML?
Void elements do not have closing tags and don’t contain content. Examples: <img>,
<input>, <br>.
--------------------------------------------------
### 5. What is the DOCTYPE declaration?
The DOCTYPE declaration specifies the HTML version used in the document. Example:
<!DOCTYPE html> (for HTML5).
--------------------------------------------------
### 6. What is the difference between <div> and <span>?
- <div>: Block-level container used to group elements. Takes full width.
- <span>: Inline container used to style parts of text.
--------------------------------------------------
### 7. What is the purpose of the <meta> tag?
Provides metadata like character set, viewport settings, and page description.
Example:
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
--------------------------------------------------
### 8. What are semantic elements in HTML?
Semantic elements clearly describe their meaning to browsers and developers.
Examples: <article>, <header>, <footer>, <section>.
--------------------------------------------------
### 9. What is the difference between <link> and <a> tags?
- <link>: Links external resources like CSS files.
- <a>: Creates hyperlinks to other web pages or sections.
--------------------------------------------------
### 10. What is the difference between id and class attributes?
- id: Uniquely identifies an element.
- class: Assigns the same style to multiple elements.
... (Truncated for brevity)
### 50. What is the purpose of the <base> tag?
Defines the base URL for relative links in the document. Example:
<base href="https://www.example.com/">
<a href="about.html">About Us</a> <!-- Links to https://www.example.com/about.html
-->
==================================================
End of Document.