CSS & HTML Tips,
    Made Simple

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

    Serving responsive background images with the CSS image-set function
    CSS7 min

    Serving responsive background images with the CSS image-set function

    While the HTML <picture> element handles responsive inline images, CSS background images have historically required complex media queries. The image-set() function allows the browser to automatically select the most appropriate background image based on screen resolution and format support.

    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

    The HTML <search> element provides a semantic landmark for search and filtering interfaces without requiring ARIA roles. This article covers the exact criteria for when to use <search> versus a standard <form>, and how it impacts screen reader navigation.

    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

    The display: contents property allows an element to visually disappear while its children participate directly in the parent's Grid or Flexbox layout. This article breaks down how it works, when to use it for semantic HTML, and the historical accessibility bugs you need to know.

    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

    CSS now supports advanced mathematical functions like round(), mod(), and rem() natively. This article explains how to use these functions to calculate dynamic grid tracks, snap typography to a baseline grid, and avoid complex JavaScript resize listeners.

    Editor: Paul Radford
    Jul 2, 2026
    layout
    CSS @when/@else: Writing Conditional Styles Without JavaScript
    CSS7 min

    CSS @when/@else: Writing Conditional Styles Without JavaScript

    Explore the new CSS @when and @else at-rules that bring conditional logic directly into stylesheets. This article covers practical use cases for creating state-dependent styles, responsive behavior without media queries, and theme switching that actually makes sense.

    Editor: Paul Radford
    Jul 2, 2026
    selectorsfrontend
    Adapting UI components for Windows High Contrast mode using forced-colors
    CSS8 min

    Adapting UI components for Windows High Contrast mode using forced-colors

    Windows High Contrast mode forces a user-defined color palette on web pages, often breaking custom UI components like styled checkboxes or buttons. The forced-colors media query allows developers to detect this mode and apply specific CSS to restore visibility.

    Editor: Paul Radford
    Jul 2, 2026
    Building exclusive accordions natively with the HTML details name attribute
    HTML8 min

    Building exclusive accordions natively with the HTML details name attribute

    Developers have historically relied on JavaScript to create exclusive accordions where opening one panel closes the others. The new name attribute on the HTML details element solves this natively, allowing browsers to handle the state management.

    Editor: Paul Radford
    Jul 2, 2026
    frontend
    Custom List Markers with @counter-style: Beyond Bullet Points
    CSS7 min

    Custom List Markers with @counter-style: Beyond Bullet Points

    Custom List Markers with @counter-style: Beyond Bullet Points

    Editor: Paul Radford
    Jun 28, 2026
    typographyfrontendlists