HTML INTERVIEW REVISION GUIDE
1. Introduction to HTML
- HTML (HyperText Markup Language) is the standard language for creating web pages.
- Uses tags to structure content.
- Latest version: HTML5.
2. HTML Document Structure
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Heading</h1>
<p>Paragraph</p>
</body>
</html>
3. Semantic HTML
Semantic HTML provides meaning to the structure of a web page.
Common Semantic Elements:
<header> - Defines a page header
<nav> - Defines navigation links
<section> - Groups content
<article> - Defines self-contained content
<aside> - Sidebar content
<footer> - Defines a footer
4. HTML Forms
Forms are used to collect user input.
<form action="submit.php" method="POST">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<button type="submit">Submit</button>
</form>
5. HTML Input Types
<input type="text">
<input type="email">
<input type="password">
<input type="checkbox">
<input type="radio">
<input type="file">
<input type="submit">
6. Tables in HTML
<table>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Alice</td>
<td>25</td>
</tr>
</table>
7. HTML5 Features
- Audio & Video Support: <audio> and <video> elements.
- Canvas & SVG: Used for graphics.
- Geolocation API: Fetches user location.
- Local Storage & Session Storage: Stores data in the browser.
8. Accessibility in HTML
- Use alt attribute in images for screen readers.
- Use ARIA attributes (aria-label, aria-hidden).
- Ensure forms have labels.
9. Meta Tags for SEO
<meta name="description" content="Best HTML Guide for Interviews">
<meta name="keywords" content="HTML, Frontend, Interview, Web Development">
10. Best Practices
Use semantic elements.
Write clean, indented code.
Optimize images and performance.
Ensure mobile responsiveness.
Follow accessibility guidelines.
11. HTML Interview Questions
Q1: What is the difference between id and class?
id is unique, used for a single element, while class can be used for multiple elements.
Q2: How do you create a hyperlink in HTML?
<a href="https://example.com">Visit Example</a>
Q3: What is the difference between <b> and <strong>?
<b> makes text bold visually, while <strong> has semantic importance.
Q4: How do you embed a video in HTML?
<video controls>
<source src="video.mp4" type="video/mp4">
</video>
Q5: What is the difference between sessionStorage and localStorage?
sessionStorage stores data for a session (clears on close), while localStorage persists until
manually deleted.
---
This guide covers the essentials needed for HTML interviews. Good luck!