Interview Q&A · questions with model answers

HTML & CSS Interview Questions

Part of the study plan for: Frontend Engineer · Full Stack Engineer

Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.

  1. Why must every form field have a label, and how do you associate one?

    Labels give fields an accessible name that screen readers announce, and clicking a label focuses its field. Associate them with for on the label matching the field's id, or by wrapping the input…

  2. Why isn't client-side validation enough?

    Anyone can bypass it: disable JavaScript, edit the DOM, or send requests directly with curl. It improves the user experience, but only server-side validation protects data integrity and security.

  3. Why use button and a instead of a clickable div?

    Native buttons and links are focusable, work with Enter (and Space for buttons), expose the right role to screen readers and support browser features such as opening links in new tabs. A clickable…

  4. Why should you declare the character encoding, and how?

    With <meta charset="utf-8"> early in the head (within the first 1024 bytes), so the browser decodes the bytes correctly. Without it, text with non-ASCII characters can turn into mojibake such as é…

Was this page helpful?

Report a mistake