Home/CSS-Tricks
Source

CSS-Tricks

2,268 articles from CSS-Tricks.

Frontend — CSS shape() Commands

CSS shape() Commands

The CSS shape() function recently gained support in both Chromium and WebKit browsers. It's a way of drawing complex shapes when clipping elements with the clip-path property.

GGGeoff GrahamGeoff Graham·May 2, 2025Frontend
Frontend — Revisiting Image Maps

Revisiting Image Maps

Let’s run through a quick refresher. Image maps date all the way back to HTML 3.2, where, first, server-side maps and then client-side maps defined clickable regions over an image using map and area elements.

ACAndy ClarkeAndy Clarke·April 30, 2025Frontend
Design & UX — Open Up With Brad Frost, Episode 2

Open Up With Brad Frost, Episode 2

Brad Frost is running this new little podcast called Open Up. Folks write in with questions about the "other" side of web design and front-end development —

GGGeoff GrahamGeoff Graham·April 29, 2025Design & UX
Frontend — The Lost CSS Tricks of Cohost.org

The Lost CSS Tricks of Cohost.org

In this post, Blackle Mori shows you a few of the hacks found while trying to push the limits of Cohost’s HTML support. Use these if you dare, lest you too get labelled a CSS criminal.

BMBlackle Mori·April 24, 2025Frontend
Engineering — Quick Hit #44

Quick Hit #44

The CSSWG just released the first public working draft of the specifications for adding gap decorations — you know, like drawing lines between boxes in

GGGeoff GrahamGeoff Graham·April 21, 2025Engineering
Frontend — Using CSS backdrop-filter for UI Effects

Using CSS backdrop-filter for UI Effects

Tips and tricks on utilizing the CSS backdrop-filter property to style user interfaces. You’ll learn how to layer backdrop filters among multiple elements, and integrate them with other CSS graphical effects to create elaborate designs.

PPreethiPreethi·April 16, 2025Frontend
Frontend — Next Level CSS Styling for Cursors

Next Level CSS Styling for Cursors

Custom cursors with CSS are great, but we can take things to the next level with JavaScript. Using JavaScript, we can transition between cursor states, place dynamic text within the cursor, apply complex animations, and apply filters.

DCDeclan ChidlowDeclan Chidlow·April 14, 2025Frontend
Frontend — CSS-Tricks Chronicles XLIII

CSS-Tricks Chronicles XLIII

This CSS-Tricks update highlights significant progress in the Almanac, recent podcast appearances, a new CSS counters guide, and the addition of several new authors contributing valuable content.

GGGeoff GrahamGeoff Graham·April 11, 2025Frontend
Frontend — Tailwind's @apply Feature is Better Than it Sounds

Tailwind's @apply Feature is Better Than it Sounds

Most of the time, people showcase Tailwind's @apply feature with one of Tailwind's single-property utilities (which changes a single CSS declaration). When showcased this way, @apply doesn't sound promising at all. So obviously, nobody wants to use it. Personally, I think Tailwind's @apply feature is better than described.

ZLZell LiewZell Liew·April 10, 2025Frontend
Frontend — CSS Carousels

CSS Carousels

Chrome has prototyped these features and released them in Chrome 135. Adam Argyle has a wonderful explainer over at the Chrome Developer blog. Kevin Powell has an equally wonderful video where he follows the explainer. This post is me taking notes from them.

GGGeoff GrahamGeoff Graham·April 9, 2025Frontend
Frontend — A New "Web" Readiness Report

A New "Web" Readiness Report

HTML 5 Readiness was a site that showed through a rainbow of colors the browser support for several web features. What about a new version?

JDJuan Diego RodríguezJuan Diego Rodríguez·April 4, 2025Frontend
Frontend — SMIL on?

SMIL on?

Well, it turns out that SVG's built-in animation features were never deprecated as planned. Sure, CSS and JavaScript are more than capable of carrying the load, but it's good to know that SMIL is not dead in the water as previously thought, and is actually well-supported.

GGGeoff GrahamGeoff Graham·April 2, 2025Frontend
Frontend — Crafting Strong DX With Astro Components and TypeScript

Crafting Strong DX With Astro Components and TypeScript

One thing we can do to help teams code consistently is provide type-checking so that all of the configurable options for a specific component are available while coding. Bryan demonstrates how he does this with TypeScript when working with Astro components.

BRBryan RobinsonBryan Robinson·April 1, 2025Frontend
Frontend — Worlds Collide: Keyframe Collision Detection Using Style Queries

Worlds Collide: Keyframe Collision Detection Using Style Queries

Interactive CSS animations with elements ricocheting off each other seem more plausible in 2025. While it’s unnecessary to implement Pong in CSS, the increasing flexibility and power of CSS reinforce Lee's suspicion that one day it will be a lifestyle choice whether to achieve any given effect with scripting or CSS.

LMLee MeyerLee Meyer·March 31, 2025Frontend
Frontend — Quick Hit #42

Quick Hit #42

Masonry in CSS: There’s a new, third option in the debate that combines Flexbox and CSS Grid features into a new system of “Item Flow” properties. The WebKit

GGGeoff GrahamGeoff Graham·March 29, 2025Frontend
Architecture — Automated Visual Regression Testing With Playwright

Automated Visual Regression Testing With Playwright

With visual regression testing, we can update a page, take screenshots before and after the fact, and compare the results for unintended changes. In this article, learn how to set up visual regression testing using Playwright.

FDFrederik DohrFrederik Dohr·March 28, 2025Architecture
Frontend — Revisiting CSS border-image

Revisiting CSS border-image

I’ve used border-image regularly. Yet, it remains one of the most underused CSS tools, and I can’t, for the life of me, figure out why. Is it possible that people steer clear of border-image because its syntax is awkward and unintuitive? Perhaps it’s because most explanations don’t solve the type of creative implementation problems that most people need to solve. Most likely, it’s both.

ACAndy ClarkeAndy Clarke·March 21, 2025Frontend
Frontend — Quick Hit #40

Quick Hit #40

Smashing Magazine is hosting a free online event discussing modern CSS goodness with the likes of Adam Argyle, Julia Miocene, and Miriam Suzanne this — no

GGGeoff GrahamGeoff Graham·March 18, 2025Frontend
Frontend — Styling Counters in CSS

Styling Counters in CSS

Going from the most basic ways to style lists directly in HTML to advanced customization techniques that are even capable of making things that aren't lists look like lists.

JDJuan Diego RodríguezJuan Diego Rodríguez·March 17, 2025Frontend
Engineering — Web Components Demystified

Web Components Demystified

Scott Jehl released a course called Web Components Demystified. This is my full set of notes from Scott's course. You'll still want to take the course on your own, and I encourage you to because Scott is an excellent teacher who makes all of this stuff extremely accessible, even to noobs like me.

GGGeoff GrahamGeoff Graham·March 14, 2025Engineering
Engineering — Powering Search With Astro Actions and Fuse.js

Powering Search With Astro Actions and Fuse.js

With Astro, we can generate most of our site during our build, but have a small bit of server-side code that can handle search functionality using something like Fuse.js. In this demo, we’ll use Fuse to search through a set of personal “bookmarks” that are generated at build time, but return back proper results from a server call.

BRBryan RobinsonBryan Robinson·March 11, 2025Engineering
Design & UX — Smashing Meets Accessibility

Smashing Meets Accessibility

The videos from Smashing Magazine's recent event on accessibility were just posted the other day. I was invited to host the panel discussion with the speakers, including a couple of personal heroes of mine, Stéphanie Walter and Sarah Fossheim. But I was just as stoked to meet Kardo Ayoub who shared his deeply personal story as a designer with a major visual impairment.

GGGeoff GrahamGeoff Graham·March 10, 2025Design & UX
Frontend — A CSS-Only Star Rating Component and More! (Part 2)

A CSS-Only Star Rating Component and More! (Part 2)

In this second article of a two-part series, Temani Afif demonstrates an alternative approach to creating the star rating component from the first article using experimental scroll-driven animations rather than using the border-image property.

TATemani AfifTemani Afif·March 7, 2025Frontend
Frontend — Maybe don't use custom properties in shorthand properties

Maybe don't use custom properties in shorthand properties

This easily qualifies as a "gotcha" in CSS and is a good reminder that the cascade doesn't know everything all at the same time. If a custom property is invalid, the cascade won't ignore it, and it gets evaluated, which invalidates the declaration.

GGGeoff GrahamGeoff Graham·March 6, 2025Frontend
Frontend — Functions in CSS?!

Functions in CSS?!

Arguments?! Return values?! What's crazier, you can use functions right now in Chrome Canary! So, after reading and playing around, here are my key insights on what you need to know about CSS Functions.

JDJuan Diego RodríguezJuan Diego Rodríguez·March 3, 2025Frontend
Engineering — Using & Styling the Details Element

Using & Styling the Details Element

Now that we're 5+ years into the details element, we know more about it than ever before. I thought I'd round that information up so it's in one place I can reference in the future without having to search the site — and other sites — to find it.

GGGeoff GrahamGeoff Graham·February 26, 2025Engineering
Performance — Toe Dipping Into View Transitions

Toe Dipping Into View Transitions

The View Transitions API is more a set of features than it is about any one particular thing. And it gets complex fast. But in this post, we’ll cover a couple ways to dip your toes into the waters without having to dive in head-first.

GGGeoff GrahamGeoff Graham·February 21, 2025Performance
Frontend — Handwriting an SVG Heart, With Our Hearts

Handwriting an SVG Heart, With Our Hearts

A while back on CSS-Tricks, we shared several ways to draw hearts, and the response was dreamy. Now, to show my love, I wanted to do something personal, something crafty, something with a mild amount of effort.

RTRyan TrimbleRyan Trimble·February 14, 2025Frontend
Frontend — Scroll Driven Animations Notebook

Scroll Driven Animations Notebook

Adam's such a mad scientist with CSS. He's been putting together a series of "notebooks" that make it easy for him to demo code. He's got one for gradient

GGGeoff GrahamGeoff Graham·February 13, 2025Frontend
Frontend — Quick Hit #35

Quick Hit #35

The speaker list for CSS Day 2025 is lookin' mighty fine, tell you what. Event is scheduled June 5-6 and tickets are on sale.

GGGeoff GrahamGeoff Graham·February 12, 2025Frontend
Engineering — Make Any File a Template Using This Hidden macOS Tool

Make Any File a Template Using This Hidden macOS Tool

Stationery Pad is a handy way to nix a step in your workflow if you regularly use document templates on your Mac. The long-standing Finder feature essentially tells a file’s parent application to open a copy of it by default, ensuring that the original file remains unedited.

GGGeoff GrahamGeoff Graham·February 10, 2025Engineering
Frontend — Organizing Design System Component Patterns With CSS Cascade Layers

Organizing Design System Component Patterns With CSS Cascade Layers

I enjoy organizing code and find cascade layers a fantastic way to organize code explicitly as the cascade looks at it. The neat part is, that as much as it helps with "top-level" organization, cascade layers can be nested, which allows us to author more precise styles based on the cascade and inheritance.

RTRyan TrimbleRyan Trimble·February 10, 2025Frontend
Frontend — Container query units: cqi and cqb

Container query units: cqi and cqb

A little gem from Kevin Powell's "HTML & CSS Tip of the Week" website, reminding us that using container queries opens up container query units for sizing things based on the size of the queried container.

GGGeoff GrahamGeoff Graham·February 6, 2025Frontend
Frontend — Compiling CSS With Vite and Lightning CSS

Compiling CSS With Vite and Lightning CSS

Are partials the only thing keeping you writing CSS in Sass? With a little configuration, it's possible to compile partial CSS files without a Sass dependency. Ryan Trimble has the details.

RTRyan TrimbleRyan Trimble·February 3, 2025Frontend
Career & Teams — Chrome 133 Goodies

Chrome 133 Goodies

Did you see the release notes for Chrome 133? It's currently in beta, but the Chrome team has been publishing a slew of new articles with pretty incredible demos that are tough to ignore. I figured I'd round those up in one place.

GGGeoff GrahamGeoff Graham·January 31, 2025Career & Teams
Frontend — The Mistakes of CSS

The Mistakes of CSS

All of the things that the CSS Working Group would change if they had a time-traveling Delorean to go back and do things over.

JDJuan Diego RodríguezJuan Diego Rodríguez·January 30, 2025Frontend
Engineering — What on Earth is the `types` Descriptor in View Transitions?

What on Earth is the `types` Descriptor in View Transitions?

The @view-transition at-rule has two descriptions. One is the commonly used navigation descriptor. The second is types, the lesser-known of the two, and one that probably envies how much attention navigation gets. But read on to learn why we need types and how it opens up new possibilities for custom view transitions when navigating between pages.

JDJuan Diego RodríguezJuan Diego Rodríguez·January 29, 2025Engineering
Frontend — Revisiting CSS Multi-Column Layout

Revisiting CSS Multi-Column Layout

After 20 years since Andy Clarke first published his book about Multi-Column Layout in CSS, he's back to encourage a fresh look at CSS columns for enhanced readability and design flexibility.

ACAndy ClarkeAndy Clarke·January 27, 2025Frontend
Frontend — Positioning Text Around Elements With CSS Offset

Positioning Text Around Elements With CSS Offset

When it comes to positioning elements on a page, including text, there are many ways to go about it in CSS — the literal position property with corresponding inset-* properties, translate, margin, anchor() (limited browser support at the moment), and so forth. The offset property is another one that belongs in that list.

PPreethiPreethi·January 24, 2025Frontend
Engineering — Creating a "Starred" Feed

Creating a "Starred" Feed

Chris wrote about "Likes" pages a long while back. The idea is rather simple: "Like" an item in your RSS reader and display it in a feed of other liked items.

GGGeoff GrahamGeoff Graham·January 21, 2025Engineering