100 HTML & CSS interview questions and answers

HTML and CSS interview questions on semantics, accessibility, the box model, flexbox and grid, specificity, responsive design and modern CSS like :has() and container queries.

Easy69 easy HTML & CSS questions

  1. 1What is HTML?
  2. 2What is the structure of an HTML document?
  3. 3What is <!DOCTYPE html>?
  4. 4Difference between HTML4 and HTML5?
  5. 5What are semantic tags?
  6. 6Examples of semantic elements?
  7. 7What is <div> vs <span>?
  8. 8What is a block vs inline element?
  9. 9What is the <meta> tag?
  10. 10What is the viewport meta tag?
  11. 11What is <head> vs <body>?
  12. 12What is the <title> tag?
  13. 13What is the <link> tag?
  14. 14What is the <script> tag?
  15. 16What is the <img> tag?
  16. 17What is the alt attribute?
  17. 18What is the <a> tag?
  18. 19Difference: absolute vs relative URL?
  19. 20What is the <form> element?
  20. 21What are form elements?
  21. 22What are input types?
  22. 23What is the label tag?
  23. 24What is the placeholder attribute?
  24. 25What is the required attribute?
  25. 27What is the <table> structure?
  26. 31What is accessibility (a11y)?
  27. 33What is aria-label?
  28. 34What is SEO in HTML?
  29. 35What is a meta description?
  30. 36What is a favicon?
  31. 37What is a data-* attribute?
  32. 40What is lazy loading (loading='lazy')?
  33. 44What is the <video> tag?
  34. 45What is the <audio> tag?
  35. 46What is the <progress> tag?
  36. 47What is <details> and <summary>?
  37. 48What is <noscript>?
  38. 51What is CSS?
  39. 52Types of CSS (inline, internal, external)?
  40. 53What is a selector?
  41. 57What is the box model?
  42. 58Difference: margin vs padding?
  43. 59What is a border?
  44. 60What is the display property?
  45. 61Block vs inline vs inline-block?
  46. 62What is visibility vs display?
  47. 63What is overflow?
  48. 64What is position?
  49. 67What is float?
  50. 68What is clear?
  51. 69What is opacity?
  52. 70What are background properties?
  53. 71What are color formats?
  54. 72What are font properties?
  55. 73What is text-align?
  56. 74What is line-height?
  57. 75What is letter-spacing?
  58. 76What is Flexbox?
  59. 78What is justify-content?
  60. 79What is align-items?
  61. 83What is a media query?
  62. 84What are breakpoints?
  63. 85What is mobile-first design?
  64. 86What is responsive design?
  65. 87What are viewport units (vh, vw)?
  66. 89What is object-fit?
  67. 90What is aspect-ratio?
  68. 93What are variables in CSS?
  69. 99What is transition?

Medium31 medium HTML & CSS questions

  1. 15Difference: defer vs async?
  2. 26What is the pattern attribute?
  3. 28What is an <iframe>?
  4. 29What is <canvas>?
  5. 30What is <svg>?
  6. 32What is ARIA?
  7. 38What is contenteditable?
  8. 39What is draggable?
  9. 41What is the <picture> tag?
  10. 42What are responsive images?
  11. 43What is srcset?
  12. 49What is tabindex?
  13. 50What is the DOM?
  14. 54Types of selectors?
  15. 55What is specificity?
  16. 56What is !important?
  17. 65Position types?
  18. 66What is z-index?
  19. 77Main axis vs cross axis?
  20. 80flex-grow, flex-shrink, flex-basis?
  21. 81What is CSS Grid?
  22. 82Grid vs Flexbox?
  23. 88What is rem vs em?
  24. 91What are CSS preprocessors (SASS)?
  25. 92What is nesting in CSS?
  26. 94What are CSS custom properties?
  27. 95What is BEM methodology?
  28. 96What are CSS Modules?
  29. 97What is Tailwind CSS?
  30. 98What is animation in CSS?
  31. 100What is transform?