🌐
Q1. What is the purpose of <!DOCTYPE html>?
A. It tells the browser to use standards mode (HTML5). Without it, the browser may fall back to quirks mode.
Entry
🌐
Q2. What is the difference between <head> and <body>?
A. <head> contains metadata/resources (title, meta, links, scripts). <body> contains the visible page content.
Entry
🌐
Q3. Block vs inline elements?
A. Block elements start on a new line and take full width by default. Inline elements flow within text.
Entry
🌐
Q4. What are void elements?
A. Elements without a closing tag, like <img>, <br>, <hr>, <input>, <meta>, <link>.
Entry
🌐
Q5. Why is alt important on images?
A. It provides text alternatives for screen readers and fallback text if the image fails to load.
Entry
🌐
Q6. How do you connect a label to an input?
A. Use <label for="id"> and set the input id, or wrap the input inside the label.
Entry
🌐
Q7. What is the meta viewport tag for?
A. It controls mobile layout scaling. Common: width=device-width, initial-scale=1.0.
Entry
🌐
Q8. What is semantic HTML?
A. Using meaningful elements like <header>, <main>, <article> for better accessibility/SEO/maintenance.
Entry