Single Element Loaders: The Spinner | CSS-Tricks

Making CSS-only loaders is one of my favorite tasks. It’s always satisfying to look at those infinite animations. And, of course, there are lots of techniques and approaches to make them — no need to look further than CodePen to see just how many. In this article, though, we will see how to make a single element loader writing as little code as possible. I have made a collection of

Read More

Am I on the IndieWeb yet? | CSS-Tricks

Can’t smash the Like button hard enough for what Miriam Suzanne has to say on the challenging technical hurdles of implementing Webmentions: The first round required several online services along with HTML & JS changes to my static site, just to verify my indieweb identity. Then more changes to the site and more online services to help fetch any mentions (so far, nothing to see, but that’s probably expected). It seems the only way

Read More

Let’s Make a QR Code Generator With a Serverless Function! | CSS-Tricks

QR codes are funny, right? We love them, then hate them, then love them again. Anyways, they’ve lately been popping up again and it got me thinking about how they’re made. There are like a gazillion QR code generators out there, but say it’s something you need to do on your own website. This package can do that. But it’s also weighs in at a hefty 180 KB for everything

Read More

Building Interoperable Web Components That Work | CSS-Tricks

Those of us who’ve been web developers more than a few years have probably written code using more than one JavaScript framework. With all the choices out there — React, Svelte, Vue, Angular, Solid — it’s all but inevitable. One of the more frustrating things we have to deal with when working across frameworks is re-creating all those low-level UI components: buttons, tabs, dropdowns, etc. What’s particularly frustrating is that

Read More

Please Give Me Some Space | CSS-Tricks

There’s all kinds of ways to do that. Some more advisable and better-suited for certain situations than others, of course. We could do it directly in HTML: <p>We go from one line…<br><br> down a couple more.</p> But that’s what CSS is really for: <p>We go from one line…<span>down a couple more.</span></p> span { display: block; margin-block-start: 1.5rem; } Line height can also give us extra breathing room between lines of

Read More

SPAs, Shared Element Transitions, and Re-Evaluating Technology | CSS-Tricks

Nolan Lawson sparked some discussion when he described a noticeable shift away from single-page applications (SPAs): Hip new frameworks like Astro, Qwik, and Elder.js are touting their MPA [multi-page application] with “0kB JavaScript by default.” Blog posts are making the rounds listing all the challenges with SPAs: history, focus management, scroll restoration, Cmd/Ctrl-click, memory leaks, etc. Gleeful potshots are being taken against SPAs. I think what’s less discussed, though, is

Read More

How to Create Block Theme Patterns in WordPress 6.0 | CSS-Tricks

Block patterns, also frequently referred to as sections, were introduced in WordPress 5.5 to allow users to build and share predefined block layouts in the pattern directory. The directory is the home of a wide range of curated patterns designed by the WordPress community. These patterns are available in simple copy and paste format, require no coding knowledge and thus are a big time saver for users. Despite many articles

Read More

Dialog Components: Go Native HTML or Roll Your Own? | CSS-Tricks

As the author of a library called AgnosticUI, I’m always on the lookout for new components. And recently, I decided to dig in and start work on a new dialog (aka modal) component. That’s something many devs like to have in their toolset and my goal was to make the best one possible, with an extra special focus on making it inclusive and accessible. My first thought was that I

Read More

A Perfect Table of Contents With HTML + CSS | CSS-Tricks

Earlier this year, I self-published an ebook called Understanding JavaScript Promises (free for download). Even though I didn’t have any intention of turning it into a print book, enough people reached out inquiring about a print version that I decided to self-publish that as well .I thought it would be an easy exercise using HTML and CSS to generate a PDF and then send it off to the printer. What

Read More

Cool CSS Hover Effects That Use Background Clipping, Masks, and 3D | CSS-Tricks

We’ve walked through a series of posts now about interesting approaches to CSS hover effects. We started with a bunch of examples that use CSS background properties, then moved on to the text-shadow property where we technically didn’t use any shadows. We also combined them with CSS variables and calc() to optimize the code and make it easy to manage. In this article, we will build off those two articles

Read More