Search
Posters! (for CSS Flexbox and CSS Grid)
6.7.2020
Any time I chat with a fellow web person and CSS-Tricks comes up in conversation, there is a good chance they’ll say: oh yeah, that guide on CSS flexbox, I use that all the time!
Indeed that page, and it’s cousin the CSS grid guide, are among our top trafficked pages. I try to take...
USA.css
6.7.2020
Lots of fun with gradients from Bennet Feely: stars, stripes, banners, bursts… I love being able to use nice patterns with either no image requests at all, or very little SVG.
And important reminder: Bennet does all sorts of cool stuff. I’ve probably used Clippy about a million times....
The Thirteenth Fourth
5.7.2020
Well boy howdy. The 13th birthday of CSS-Tricks has rolled around. A proper teenager now, howabouthat? I always take the opportunity to do a bit of a state of the union address at this time, so let’s get to it!
Design
Technically, we’re still on v17 of the site design. This was...
Fluid Images in a Variable Proportion Layout
3.7.2020
Creating fluid images when they stand alone in a layout is easy enough nowadays. However, with more sophisticated interfaces we often have to place images inside responsive elements, like this card:
For now, let’s say this image is not semantic content, but only decoration. That’s...
Settling down in a Jamstack world
3.7.2020
One of the things I like about Jamstack is that it’s just a philosophy. It’s not particularly prescriptive about how you go about it. To me, the only real requirement is that it’s based on static (CDN-backed) hosting. You can use whatever tooling you like. Those tools, though...
Some Performance Links
3.7.2020
Just had a couple of good performance links burning a hole in my pocket, so blogging them like a good little blogger.
Web Performance Recipes With Puppeteer
Puppeteer is an Node library for spinning up a copy of Chrome “headlessly” (i.e. no UI) and controlling it. People use it...
Refreshing Sidebar for 2020
3.7.2020
The new design for Sidebar is lovely. I like how it goes even deeper with the sticky elements than the last design.
But even more notably, Sacha Greif has been posting five links per day to Sidebar since 2012. That’s a remarkable achievement.
Direct Link to Article — Permalink…...
When a Line Doesn’t Break
2.7.2020
We expect a line to break when the text on that line reaches the parent box boundaries. We see this every time we create a paragraph, just like this one. When the parent box doesn’t have enough room for the next word in a line, it breaks it and moves down to the next line and repeats that...
How-to guide for creating edge-to-edge color bars that work with a grid
1.7.2020
Hard-stop gradients are one of my favorite CSS tricks. Here, Marcel Moreau combines that idea with CSS grid to solve an issue that’s otherwise a pain in the butt. Say you have like a 300px right sidebar on a desktop layout with a unique background color. Easy enough. But then say you want...
A Complete Guide to Dark Mode on the Web
1.7.2020
“Dark mode” is defined as a color scheme that uses light-colored text and other UI elements on a dark-colored background. Dark mode, dark theme, black mode, night mode… they all refer to and mean the same thing: a mostly-dark interface rather than a mostly-light interface.
The post A Complete...
New in Chrome: CSS Overview
1.7.2020
Here’s a fancy new experimental feature in Chrome! Now, we can get an overview of the CSS used on a site, from how many colors there are to the number of unused declarations… even down to the total number of defined media queries.
Again, this is an experimental feature. Not only does that...
Global and Component Style Settings with CSS Variables
1.7.2020
The title of this Sara Soueidan article speaks to me. I’m a big fan of the idea that some CSS is best applied globally, and some CSS is best applied scoped to a component. I’m less interested in how that is done and more interested in just seeing that conceptual approach used in some...
Responsive Styling Using Attribute Selectors
30.6.2020
One of the challenges we face when implementing class-based atomic styling is that it often depends on a specific breakpoint for context.
<div class="span-12"</div<!-- we want this for small screens --<div class="span-6"</div<!-- we want this for medium screens --<div...
Five 5-minute Videos from Ethan on Design & Accessibility
30.6.2020
Ethan:
I’ve been working with Aquent Gymnasium to produce a series of five short tutorial videos, which have been launching over the course of this past week. Since the last video just went live, I’m thrilled to share the whole list with you:
• Introduction to using VoiceOver on macOS•...
When Sass and New CSS Features Collide
29.6.2020
Recently, CSS has added a lot of new cool features such as custom properties and new functions. While these things can make our lives a lot easier, they can also end up interacting with preprocessors, like Sass, in funny ways.
So this is going to be a post about the issues I’ve encountered...
Styling Layout Wrappers In CSS
29.6.2020
Two things that strike me often about the web are how many ways there are to go about the same thing and how many considerations go into even the most seemingly simple things.
Working with wrapper elements is definitely on both those lists. Wrappers (or containers or whatever) are so common...
Book: The Greatest CSS Tricks Vol. I
29.6.2020
Ya know, for a site called “CSS-Tricks” that I’ve run for well over a decade, it’s a little funny we’ve never done a book under that name. I’ve written a book about WordPress and SVG, but never CSS!
Well, allow me to change that. I’ve been working on...
Quick Tips for High Contrast Mode
27.6.2020
Sarah Higley has some CSS tricks up her sleeve for dealing with High Contrast Mode on Windows, which I learned is referred to as WHCM.
Here’s the first trick:
[…] if the default CSS outline property doesn’t give you the visual effect you want [in WHCM] for focus states...
The Return of the 90s Web
26.6.2020
One of my forever-lessons here on CSS-Tricks is that having your own website and blogging on it is a good idea. It’s probably one of the best decisions I’ve ever made, as it’s been a direct source of fun, career development and, eventually, income.
I always chuckle at little...
In Defense of a Fussy Website
26.6.2020
The other day, I was doom-scrolling Twitter and saw a delightful article titled “The Case for Fussy Breakfasts.” I love food — especially breakfast — and since the pandemic hit I’ve been using my breaks in between meetings (or, shh, sometimes in meetings) to make a full bacon, poached...