🧠 1. What is HTML?
HTML stands for HyperText Markup Language.
It is the standard language used to create and structure web pages.
HTML is used to:
• Create headings
• Add paragraphs
• Insert images
• Create links
• Build forms
• Structure web content
Example:
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
🧠 2. Difference Between HTML4 and HTML5
HTML4 : Older version
HTML5 : Latest version
HTML4 : No semantic tags
HTML5 : Semantic tags added
HTML4 : No direct multimedia support
HTML5 : Supports audio/video
HTML4 : Less mobile friendly
HTML5 : Mobile optimized
HTML5 Features:
•
<video>•
<audio>•
<canvas>• Local Storage
• Semantic Tags
🧠 3. What are Semantic Tags in HTML5?
Semantic tags describe the meaning of content clearly.
Common Semantic Tags:
•
<header>•
<nav>•
<section>•
<article>•
<footer>Benefits:
✅ Better SEO
✅ Better readability
✅ Accessibility improvement
Example:
<article>
<h2>Blog Title</h2>
<p>Content here...</p>
</article>
🧠 4. Difference Between
<div> and <span> <div> : Block element <span> : Inline element <div> : Takes full width <span> : Takes required width <div> : Used for sections <span> : Used for small styling Example:
<div>Hello</div>
<span>Hello</span>
🧠 5. What is the Purpose of DOCTYPE?
<!DOCTYPE html> tells the browser which HTML version is being used. Example:
<!DOCTYPE html>
Benefits:
✅ Proper rendering
✅ Avoids browser compatibility issues
🧠 6. What are Meta Tags?
Meta tags provide information about the webpage.
Example:
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="HTML Tutorial">
Uses:
• SEO
• Responsive design
• Character encoding
🧠 7. Difference Between ID and Class
ID : Unique
Class : Reusable
ID : Uses
# in CSS Class : Uses
. in CSS Example:
<div id="header"></div>
<div class="card"></div>
<div class="card"></div>
🧠 8. What are Inline and Block Elements?
Block Elements
Start on new line
Take full width
Examples:
•
<div>•
<p>•
<h1>Inline Elements
Do not start on new line
Take only required space
Examples:
•
<span>•
<a>•
<img>🧠 9. Explain Forms in HTML
Forms collect user input.
Example:
<form>
<input type="text" placeholder="Enter Name">
<input type="email" placeholder="Enter Email">
<button>Submit</button>
</form>
Common Form Elements:
• input
• textarea
• select
• checkbox
• radio button
🧠 10. Difference Between GET and POST
GET : Data visible in URL
POST : Data hidden
GET : Less secure
POST : More secure
GET : Used for fetching
POST : Used for sending
Example:
<form method="GET"></form>
<form method="POST"></form>
🧠 11. What is localStorage and sessionStorage?
Both store data in browser.
localStorage : Permanent
sessionStorage : Temporary
localStorage : Remains after closing browser
sessionStorage : Removed after tab closes
Example:
localStorage.setItem("name", "Deepak");
sessionStorage.setItem("theme", "dark");🧠 12. What are Data Attributes?
Custom attributes used to store extra information.
Example:
<div data-userid="101">User</div>
Access in JavaScript:
element.dataset.userid
🧠 13. What is iframe?
iframe embeds another webpage inside a webpage.
Example:
<iframe src="https://example.com"></iframe>
Uses:
• YouTube videos
• Google Maps
• External websites
🧠 14. Difference Between Cookies and localStorage
Cookies : Small storage
localStorage : Large storage
Cookies : Sent to server
localStorage : Not sent automatically
Example:
document.cookie = "username=Deepak";