HTML INTERVIEW CHEATSHEET (EVERYTHING YOU MUST KNOW)
1. What is HTML?
Q: What is HTML and why is it important? A: HTML (HyperText Markup Language) is the standard language
used to create web pages. It provides the basic structure of a webpage using elements like headings,
paragraphs, images, and links.
2. HTML Document Structure
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Title</title>
</head>
<body>
<!-- Content here -->
</body>
</html>
Q: What is <!DOCTYPE html> ? A: It declares the HTML version and ensures the browser renders the page
in standards mode.
3. Semantic vs Non-Semantic Elements
Semantic Tags: header , footer , article , section , nav , main , aside , figure ,
figcaption Non-Semantic Tags: div , span
Q: Why use semantic HTML? A: Improves accessibility, SEO, and code readability. Helps screen readers and
search engines understand content.
4. Text Formatting Tags
<b> , <strong> , <i> , <em> , <mark> , <small> , <del> , <ins> , <sub> , <sup>
1
5. Lists
• Ordered List: <ol>
• Unordered List: <ul>
• Description List: <dl> , <dt> , <dd>
6. Forms and Input Types
<form>
<input type="text">
<input type="email">
<input type="password">
<input type="checkbox">
<input type="radio">
<input type="submit">
</form>
Other input types: date , file , color , range , tel , url , number , search
7. Global Attributes
• id , class , style , title , lang , dir , data-*
Q: Difference between id and class? A: id is unique ( #id in CSS); class is reusable ( .class in CSS).
8. Multimedia Tags
<video controls autoplay muted loop>
<source src="video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<audio controls>
<source src="audio.mp3" type="audio/mpeg">
</audio>
2
9. Hyperlinks and Images
<a href="https://example.com">Visit</a>
<img src="image.jpg" alt="Description">
10. Tables
<table>
<thead><tr><th>Name</th><th>Age</th></tr></thead>
<tbody><tr><td>Alice</td><td>25</td></tr></tbody>
</table>
11. Meta Tags
<meta name="description" content="Page description">
<meta name="keywords" content="HTML, web">
<meta name="author" content="Divy">
12. HTML APIs
• canvas , localStorage , sessionStorage , geolocation , drag and drop
13. HTML Entities
• < < , > > , & & , (space), © (copyright)
14. Accessibility and SEO Tips
• Use alt in <img>
• Use semantic tags
• Maintain heading hierarchy
• Use label with form fields
• Avoid empty or duplicate IDs
3
15. Common Interview Questions
1. What happens if you don’t close a tag?
2. What is the difference between <div> and <section> ?
3. What are void elements in HTML?
4. Tags that don't need closing, like <img> , <input> , <br> , <hr>
5. How do you make a website responsive in HTML?
6. Use <meta name="viewport"> , semantic layout, and CSS media queries.
7. What is the difference between HTML and HTML5?
8. HTML5 introduces semantic tags, multimedia support, APIs (canvas, storage), and improved error
handling.
🎯 Final Tips:
• Practice writing HTML code from scratch.
• Focus on clean structure and accessibility.
• Build a small portfolio page using HTML5 best practices.
Prepared By: ChatGPT for Divy Gupta Target Role: Frontend Developer at JTG