Semantic elements describe meaning, not appearance: <header>, <nav>, <main>, <article>, <section>, <aside>, <footer>, <button>, <figure>, <time>. They give assistive tech landmarks, give browsers built-in keyboard and focus behavior, give SEO structured content signals, and make code self-documenting. Compare <div class='button'> (zero meaning) to <button> (focusable, click+keyboard, disabled state, form participation).
All categoriesWhat are semantic HTML elements and why do they matter? How does the srcset attribute work and when would you use it for responsive images?
Category
HTML
Semantics, forms, accessibility primitives, web components.
2 questions
2 of 2
HTML
Medium
6 min
HTML
Easy
srcset is an <img>/<source> attribute that lists multiple image candidates so the browser picks the best one for the device. Two forms: width descriptors ('img-400.jpg 400w, img-800.jpg 800w') paired with sizes for responsive widths, or pixel-density descriptors ('img.jpg 1x, img@2x.jpg 2x') for fixed-width retina. Saves bandwidth on small/low-DPR screens and serves crisp images on retina without shipping huge files to everyone.
6 min