CSS-Trickz! also ready to join Digital Ocean

You probably want CSS-Tricks

Getting Started With WordPress Block Development

Written by: Arjun Singh

Let’s acknowledge that developing for WordPress is weird right now. Whether you’re new to WordPress or have worked with it for eons, the introduction of “Full-Site Editing” (FSE) features, including the Block Editor (WordPress 5.0) and the Site Editor (WordPress 5.9), have upended the traditional way we build WordPress themes and plugins. Even though it’s […]

Continue reading "Getting Started With WordPress Block Development" at CSS-Tricks

GIFs Without the .gif: The Most Performant Image and Video Options Right Now

Written by: Ollie Williams

So you want an auto-playing looping video without sound? In popular vernacular this is the very meaning of the word GIF. The word has stuck around but the image format itself is ancient and obsolete. Twitter, for example, has a “GIF” button that actually inserts a <video> element with an MP4 file into your tweet […]

Continue reading "GIFs Without the .gif: The Most Performant Image and Video Options Right Now" at CSS-Tricks

Named Element IDs Can Be Referenced as JavaScript Globals

Written by: Matteo Mazzarolo

Did you know that DOM elements with IDs are accessible in JavaScript as global variables? It’s one of those things that’s been around, like, forever but I’m really digging into it for the first time. If this is the first time you’re hearing about it, brace yourself! We can see it in action simply by […]

Continue reading "Named Element IDs Can Be Referenced as JavaScript Globals" at CSS-Tricks

How to Create Wavy Shapes & Patterns in CSS

Written by: Temani Afif

The wave is probably one of the most difficult shapes to make in CSS. We always try to approximate it with properties like border-radius and lots of magic numbers until we get something that feels kinda close. And that’s before we even get into wavy patterns, which are more difficult. “SVG it!” you might say, […]

Continue reading "How to Create Wavy Shapes & Patterns in CSS" at CSS-Tricks

How To Customize WordPress Block Theme Cover Templates with Dynamic Post Feature Images

Written by: Ganesh Dahal

If we browse the WordPress theme directory, a majority of themes showcase cover images. It is a feature in popular demand. The cover page trend is true even in the block theme directory screenshots as well. Let’s consider the following example from Twenty Twenty (a classic theme) which includes a cover template that can be used to […]

Continue reading "How To Customize WordPress Block Theme Cover Templates with Dynamic Post Feature Images" at CSS-Tricks

The Web is Good Now

Written by: Geoff Graham

The video of Chris Coyier’s talk at CascadiaJS 2022 is now available. It’s his first in-person talk in more than two years, so it’s great to see our good friend back on stage slinging gems on what makes the web good these days. Container Queries! WAAPI! Scroll Timelines! offset-path! FLIP! Variable fonts! Fluid type! We […]

Continue reading "The Web is Good Now" at CSS-Tricks

How I Made an Icon System Out of CSS Custom Properties

Written by: Louis Hoebregts

SVG is the best format for icons on a website, there is no doubt about that. It allows you to have sharp icons no matter the screen pixel density, you can change the styles of the SVG on hover and you can even animate the icons with CSS or JavaScript. There are many ways to […]

Continue reading "How I Made an Icon System Out of CSS Custom Properties" at CSS-Tricks

CSS Rules vs. CSS Rulesets

Written by: Geoff Graham

The latest spec: A style rule is a qualified rule that associates a selector list with a list of property declarations and possibly a list of nested rules. They are also called rule sets in CSS2. Louis Lazaris: As the above quote from W3C indicates, it seems like the W3C considers “rule set” to be a bit of an outdated term, preferring the term […]

Continue reading "CSS Rules vs. CSS Rulesets" at CSS-Tricks

CSS Checkerboard Background… But With Rounded Corners and Hover Styles

Written by: Preethi

On one hand, creating simple checkered backgrounds with CSS is easy. On the other hand, though, unless we are one of the CSS-gradient-ninjas, we are kind of stuck with basic patterns. At least that’s what I thought while staring at the checkered background on my screen and trying to round those corners of the squares […]

Continue reading "CSS Checkerboard Background… But With Rounded Corners and Hover Styles" at CSS-Tricks

Making a Real-Time Clock With a Conic Gradient Face

Written by: Brecht De Ruyte

Gradients have been a part of the CSS spectrum for quite some time now. We see a lot of radial and linear gradients in a lot of projects, but there is one type of gradient that seems to be a bit lonely: the conic gradient. We’re going to make a watch face using this type […]

Continue reading "Making a Real-Time Clock With a Conic Gradient Face" at CSS-Tricks

More Details on `details`

Written by: Geoff Graham

A lot of chatter around the ol’ <details> and <summary> elements lately! I saw Lea Verou recently tweet an observation about the element’s display behavior and that sorta splintered into more observations and usage notes from folks, including a revived discussion on whether <summary> should be allowed to contain interactive elements or not. There are […]

Continue reading "More Details on `details`" at CSS-Tricks

When is it OK to Disable Text Selection?

Written by: Daniel Schwarz

Using CSS, it’s possible to prevent users from selecting text within an element using user-select: none. Now, it’s understandable why doing so might be considered “controversial”. I mean, should we be disabling standard user behaviors? Generally speaking, no, we shouldn’t be doing that. But does disabling text selection have some legitimate (albeit rare) use-cases? I […]

Continue reading "When is it OK to Disable Text Selection?" at CSS-Tricks