CSS & HTML Tips,
    Made Simple

    Practical web development tips, snippets, and template tricks you can use today.

    Why native lazy loading hurts LCP and how to fix it
    Quick Tip8 min

    Why native lazy loading hurts LCP and how to fix it

    Analyzes the performance penalty of using loading="lazy" on above-the-fold images. Demonstrates how to properly combine eager loading for hero images with lazy loading for off-screen content.

    Editor: Paul Radford
    Aug 10, 2026
    frontend
    Optimizing LCP with the HTML fetchpriority attribute
    HTML7 min

    Optimizing LCP with the HTML fetchpriority attribute

    Not every image on a page deserves the same loading priority from the browser's default heuristics. Here's when to mark the hero image high, and when deprioritizing the rest helps LCP more.

    Editor: Paul Radford
    Jul 26, 2026
    frontend
    How to use the advanced CSS attr() function for types and units
    CSS7 min

    How to use the advanced CSS attr() function for types and units

    attr(data-color color, #333) feeding straight into background-color sounds like it already ships, but as of early 2026 it's spec-only. Here's what attr() actually does today, and what's coming.

    Editor: Paul Radford
    Jul 26, 2026
    selectorsfrontend
    Animating to height auto using CSS interpolate-size
    CSS8 min

    Animating to height auto using CSS interpolate-size

    height: auto was never a number the browser could interpolate toward, which is exactly why it never animated at all. These two features finally give the engine something concrete to target.

    Editor: Paul Radford
    Jul 20, 2026
    animationlayoutfrontend
    Serving responsive background images with the CSS image-set function
    CSS7 min

    Serving responsive background images with the CSS image-set function

    Three separate min-resolution media query blocks plus an @supports check for WebP used to be needed just to keep background images in sync. image-set() resolves all of that on its own now.

    Editor: Paul Radford
    Jul 2, 2026
    When and how to use the HTML search element
    HTML8 min

    When and how to use the HTML search element

    role='search' bolted onto a plain form is one more attribute developers reliably forget to add. The new <search> element makes that semantic landmark the default instead of an opt-in extra.

    Editor: Paul Radford
    Jul 2, 2026
    forms
    Removing wrapper nodes from CSS Grid and Flexbox with display: contents
    CSS8 min

    Removing wrapper nodes from CSS Grid and Flexbox with display: contents

    Grid and Flexbox both expect their items to be direct children of the container, but semantic HTML forces wrapper elements in between. display: contents removes the wrapper's box, not its markup.

    Editor: Paul Radford
    Jul 2, 2026
    layoutgrid
    How to use CSS math functions round, mod, and rem for layout calculations
    CSS7 min

    How to use CSS math functions round, mod, and rem for layout calculations

    Rounding a fluid width to the nearest multiple of 8px used to require a resize listener writing values back to a custom property. These math functions run natively at layout time instead.

    Editor: Paul Radford
    Jul 2, 2026
    layout