CSS Tricks

Breaking Boundaries: Building a Tangram Puzzle With (S)CSS

Sladjana Stojanovic |
We put it to the test and it turns out Sass can replace JavaScript, at least when it comes to low-level logic and puzzle behavior. With nothing but maps, mixins, functions, and a whole lot of math, we managed to bring our Tangram puzzle to life, no JavaScript required. Breaking Boundaries: Buildin... read more

Creating an Auto-Closing Notification With an HTML Popover

Preethi |
The HTML popover attribute transforms elements into top-layer elements that can be opened and closed with a button or JavaScript. Popovers can be dismissed a number of ways, but there is no option to auto-close them. Preethi has a technique you can use. Creating an Auto-Closing Notification With ... read more

Better CSS Shapes Using shape() — Part 3: Curves

Temani Afif |
This is the third article in a series about the CSS shape() function. We've covered drawing lines and arcs in previous articles and, this time, we look specifically at the curve command and how to use it for drawing complex shapes. Better CSS Shapes Using shape() — Part 3: Curves originally publis... read more

Exploring the CSS contrast-color() Function… a Second Time

Daniel Schwarz |
The contrast-color() function doesn’t check color contrast, but rather it outright resolves to either black or white (whichever one contrasts the most with your chosen color). Safari Technology Preview recently implemented it and we explore its possible uses in this article. Exploring the CSS cont... read more

The State of CSS 2025 Survey is out!

Juan Diego Rodríguez |
The State of CSS 2025 Survey dropped a few days ago, and besides anticipating the results, it's exciting to see a lot of the new things shipped to CSS reflected in the questions. The State of CSS 2025 Survey is out! originally published on CSS-Tricks, which is part of the DigitalOcean family. You ... read more

Getting Creative With HTML Dialog

Andy Clarke |
So, how can you take dialogue box design beyond the generic look of frameworks and templates? How can you style them to reflect a brand’s visual identity and help to tell its stories? Here’s how I do it in CSS using ::backdrop, backdrop-filter, and animations. Getting Creative With HTML Dialog ori... read more

Better CSS Shapes Using shape() — Part 2: More on Arcs

Temani Afif |
This is the second part of a series that dives deep into the CSS shape() command, continuing with a more detailed look at the arc command. Better CSS Shapes Using shape() — Part 2: More on Arcs originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newslet... read more

What We Know (So Far) About CSS Reading Order

Daniel Schwarz |
The reading-flow and reading-order proposed CSS properties are designed to specify the source order of HTML elements in the DOM tree, or in simpler terms, how accessibility tools deduce the order of elements. You’d use them to make the focus order of focusable elements match the visual order, as ou... read more

Better CSS Shapes Using shape() — Part 1: Lines and Arcs

Temani Afif |
This is the first part of a series that dives deep into the shape function, starting with shapes that use lines and arcs. Better CSS Shapes Using shape() — Part 1: Lines and Arcs originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter. ... read more

You can style alt text like any other text

Geoff Graham |
Clever, clever that Andy Bell. He shares a technique for displaying image alt text when the image fails to load. Well, more precisely, it's a technique to apply styles to the alt when the image doesn't load, offering a nice UI fallback for what would otherwise be a busted-looking error. You can st... read more