Using CSS Cascade Layers to Manage Custom Styles in a Tailwind Project | CSS-Tricks

If a utility class only does one thing, chances are you don’t want it to be overridden by any styles coming from elsewhere. One approach is to use !important to be 100% certain the style will be applied, regardless of specificity conflicts. The Tailwind config file has an !important option that will automatically add !important to every utility class. There’s nothing wrong with using !important this way, but nowadays there

Read More

Removing jQuery from GOV.UK | CSS-Tricks

The GOV.UK team recently published “How and why we removed jQuery from GOV.UK“. This was an insightful look at how an organization can assess its tooling and whether something is still the best tool for the job. This is not a nudge to strip libraries out of your current project right now! Many of us may still be supporting legacy projects and browser requirements that prevent this from being a

Read More

CSS Grid and Custom Shapes, Part 2 | CSS-Tricks

Alright, so the last time we checked in, we were using CSS Grid and combining them with CSS clip-path and mask techniques to create grids with fancy shapes. Here’s just one of the fantastic grids we made together: CodePen Embed Fallback Ready for the second round? We are still working with CSS Grid, clip-path, and mask, but by the end of this article, we’ll end up with different ways to

Read More

When Do You Use CSS Columns? | CSS-Tricks

That ain’t rhetorical: I’m really interested in finding great use cases for CSS multi-column layouts. The answer seems straightforward. Use columns when you want to split any content into columns, right? Here is generally the sort of example you’ll find in articles that show how CSS mutli-column layouts work, including our very own Almanac: CodePen Embed Fallback Right on. But is this an actual use case? Mmmmmaybe. If the text

Read More

Why (and How) I Write Code With Pencil and Paper | CSS-Tricks

If the thought of handwriting code seems silly, it might surprise you to know that it’s inevitable. If you’re unsure, think about the last job interview you did, and remember how there was no computer around in the interview room — just your interviewers, a blank sheet of paper, and a blue ball-point pen. For the students among you, it’s even a bigger deal as your grades hang in by

Read More

CSS Grid and Custom Shapes, Part 1 | CSS-Tricks

In a previous article, I looked at CSS Grid’s ability to create complex layouts using its auto-placement powers. I took that one step further in another article that added a zooming hover effect to images in a grid layout. This time, I want to dive into another type of grid, one that works with shapes. Like, what if the images aren’t perfectly square but instead are shaped like hexagons or

Read More

Quick Tip: Clear VS Code Cache for Open Files | CSS-Tricks

If you use VS Code, you might have enabled the setting for re-opening a previously open file next time the app launches. I do. I like that. Hey, thanks for remembering, buddy! 🤗 But sometimes you really, really don’t want that to happen. I recently ran into one of those times! I had to reinstall my local copy of this site and, with it, the 3GB+ database that accompanies it.

Read More

Designing for Long-Form Articles | CSS-Tricks

Designing a beautiful “article” is wrought with tons of considerations. Unlike, say, a homepage, a long-form article is less about designing an interface than it is designing text in a way that creates a relaxed and comfortable reading experience. That’s because articles deal with long-form content which, in turn, tends to be valued by a ”time on page” interaction with users. We want someone to read a complete narrative. There’s

Read More

Committing CSS Crimes | CSS-Tricks

The time for CSS-Tricks is over. Now is the time for CSS Crimes! In this current landscape of content service providers, users are often limited to expressing themselves in text, links, and images. Sanitization rules tend to strip out HTML, JavaScript, and various attributes. Social media service Cohost allows users to have greater freedom with markup and inline styles than we may be typically used to. Some users have taken

Read More

Zooming Images in a Grid Layout | CSS-Tricks

Creating a grid of images is easy, thanks to CSS Grid. But making the grid do fancy things after the images have been placed can be tricky to pull off. Say you want to add some fancy hover effect to the images where they grow and zoom beyond the rows and columns where they sit? We can do that! CodePen Embed Fallback Cool, right? If you check the code, you

Read More