Blog
Articles about web development, design, performance, and related topics. Subscribe via RSS to keep up with new articles, or browse by topic.
- Test responsive layouts with awkward content
Test responsive layouts with long titles, missing images, empty fields, translations, slow loading, keyboard navigation, and zoom before publishing.
- Building for Right-to-Left Layouts With Logical CSS
Learn how CSS logical properties make layouts work better for both left-to-right and right-to-left languages.
- Set up favicons for browsers and home screens
A simple favicon setup that covers modern browsers and devices without generating dozens of unnecessary files.
- Better One-Time Code Inputs Without Six Tiny Boxes
Use one labelled input for verification codes, with paste, a numeric keyboard, and autofill. Keep leading zeroes and validate the code on the server.
- Getting Form Data With the FormData API
Use FormData to collect named form fields, inspect values, handle checkboxes and files, and send data with fetch while keeping normal form submission.
- requestSubmit() vs submit(): validation and events
Compare requestSubmit() and submit() for JavaScript form submission. Keep browser validation and submit events, and choose which button submits the form.
- JavaScript Module Scripts Are Deferred by Default
JavaScript module scripts are deferred by default. Use imports and head entry points, understand async exceptions, and distinguish parsing from readiness.
- defer, async, and type="module": How Scripts Actually Load
Compare defer, async, and type="module" script loading. Choose execution timing for DOM access and dependencies, including inline scripts and their limits.
- A Progressive Enhancement Pattern With Custom Elements
A progressive enhancement pattern with custom elements: add a password visibility button after setup, keep the native field, and avoid duplicate controls.
- Web Components Make More Sense When They Enhance HTML
Use Web Components to enhance working HTML. Build an optional word counter, preserve native form behaviour, and handle setup when an element reconnects.
- How to Style Broken Images Without JavaScript
Style broken images with useful alt text, stable dimensions, and scoped CSS. Keep captions readable and understand the limits of browser error rendering.
- Defensive CSS for Long Words, URLs, and Unexpected Content
Defensive CSS keeps layouts usable with long text, missing images, and larger labels. Choose wrapping, cropping, and sizing rules that match real content.
- 1fr vs minmax(0, 1fr) in CSS Grid
Compare 1fr with minmax(0, 1fr) in CSS Grid. Control track minimums, handle wide content, and keep sidebar layouts usable when the screen gets narrower.
- Fix Flexbox Overflow With min-width: 0
Use min-width: 0 to let flex items shrink below their automatic minimum. Handle long text, ellipsis, and code blocks without hiding useful content.
- What CSS appearance Actually Does
CSS appearance changes a form control’s styling. Restyle a select, add its arrow back, and keep labels, focus, and checked states easy to recognise.
- Style Native Form Controls With accent-color
Use accent-color to style native checkboxes, radios, sliders, and progress indicators. Keep their behaviour, set up dark mode, and check focus states.
- Stop Scrollbar Layout Shifts With scrollbar-gutter
Use scrollbar-gutter to reserve space for classic scrollbars. Compare stable and both-edges, handle panels, and understand why overlay scrollbars differ.
- Prevent Scroll Chaining With overscroll-behavior
overscroll-behavior controls scrolling at a container's boundary. Compare contain and none, use axis-specific rules, and understand the limits for modals.
- Keep scroll targets clear with CSS scroll-padding
scroll-padding sets a viewing inset for anchor targets and snap positions. See page, gallery, and panel examples, plus how it differs from normal padding.
- Keep Anchor Links Below Sticky Headers With scroll-margin
scroll-margin keeps anchor targets clear of sticky headers. Set a useful offset, account for changing header heights, and keep smooth scrolling optional.