CSS LAYOUT ========== START WITH THE BOX MODEL ------------------------ This makes declared dimensions include padding and border. *, *::before, *::after { box-sizing: border-box; } FLEXBOX OR GRID? ---------------- Use Flexbox for a one-dimensional row or column. Use Grid when rows and columns need to align together. .toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; } .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; } RESPONSIVE HABITS ----------------- - Start with a layout that works at narrow viewport widths. - Prefer max-width for readable text and fluid widths for containers. - Use rem for spacing and clamp() for smoothly scaling type. - Let content wrap; avoid fixed heights for text-heavy cards. INTERACTION STATES ------------------ Keep visible keyboard focus and do not communicate state with color alone. :focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }