1. Top HTML Interview Questions & Answers
Q1: What is the difference between HTML elements and HTML tags?
Answer: An HTML tag is the syntax keyword enclosed in brackets (e.g. and
Q2: What is Quirks Mode and how do you avoid it?
Answer: If a document lacks the preamble, browsers render pages in Quirks Mode to support legacy 1990s web pages, resulting in broken modern CSS layouts. Specifying forces modern Standards Mode.
Q3: What are the differences between sessionStorage, localStorage, and cookies?
Answer: Cookies store up to 4KB and are sent with every HTTP request. LocalStorage stores up to 5-10MB and persists permanently on the client. SessionStorage stores data for the duration of the browser tab session only.
Q4: What is the difference between async and defer in script loading?
Answer: Both download scripts asynchronously without blocking HTML parsing. async executes as soon as the script downloads (potentially before DOM parsing finishes and in non-deterministic order). defer executes in exact document order only after HTML parsing is completely done.