How to Make a Folder “Slit” Effect With CSS | CSS-Tricks

[ad_1] When you put something — say a regular sheet of paper — in a manilla folder, a part of that thing might peek out of the folder a little bit. The same sort of thing with a wallet and credit cards. The cards poke out just a smidge so you can get a quick glance of which cards you’re carrying. Credit: Stephen Phillips on Unsplash I call this sort of thing a

Read More

Manuel Matuzovic: max() Trickery | CSS-Tricks

[ad_1] By way of a post by Manuel Matuzović which is by way of a demo by Temani Afif. .wrapper { margin-inline: max(0px, ((100% – 64rem) / 2)); } You’d be doing yourself a favor to read Manuel’s breakdown of all what’s happening here, but it basically works out to the equivalent of this longer syntax: .wrapper { max-width: 64rem; margin: 0 auto; width: 100%; } …where: max() acecepts a

Read More

A Pure CSS Gallery Focus Effect with :not | CSS-Tricks

[ad_1] Oftentimes in the past, I needed to figure out how to add styles to all elements inside the container but not the hovered one. Demo of the expected “fade-out” effect on siblings to let users “focus” on a particular element. This effect requires selecting the siblings of a hovered element. I used to apply JavaScript for this, adding or removing the class that defined the proper CSS rules on

Read More

Fancy Image Decorations: Single Element Magic | CSS-Tricks

[ad_1] As the title says, we are going to decorate images! There’s a bunch of other articles out there that talk about this, but what we’re covering here is quite a bit different because it’s more of a challenge. The challenge? Decorate an image using only the <img> tag and nothing more. That right, no extra markup, no divs, and no pseudo-elements. Just the one tag. Sounds difficult, right? But

Read More

Behind the CSScenes, October 2022 | CSS-Tricks

[ad_1] Well, hey, welcome back to Behind the CSScenes! These posts are like little check-ins we’re doing each month to give you a peek behind what we’re doing here at CSS-Tricks, as well as a chance for us to pause and celebrate a few things. Last month, we shared a small taste of a redesign for this very site. Thanks to all the folks who wrote in to comment on

Read More

Some Things I Took Away From An Event Apart 2022 in Denver | CSS-Tricks

[ad_1] An Event Apart 2022 Denver wrapped up yesterday. And while I was unable to make it to all three days this time, I did catch yesterday’s action — and it was awesome. I’m not very social or outgoing, but this was the first conference I’ve been to in at least a couple of years, and seeing folks in person was incredibly refreshing. I took notes, of course! I thought

Read More

Rendering External API Data in WordPress Blocks on the Front End | CSS-Tricks

[ad_1] There’ve been some new tutorials popping here on CSS-Tricks for working with WordPress blocks. One of them is an introduction to WordPress block development and it’s a good place to learn what blocks are and to register them in WordPress for use in pages and posts. While the block basics are nicely covered in that post, I want to take it another step forward. You see, in that article,

Read More

Early Days of Container Style Queries | CSS-Tricks

[ad_1] We’re still in suuuuuper early days with container queries. Too early for broad browser support, but Chromium already supports it, Safari started supporting it in version 16, and Firefox is presumably not far behind. Most early days conversations revolving around container queries usually compare the syntax to media queries. /* Stacked flex container */ .post { display: flex; flex-direction: column; } /* Change direction when viewport is 600px or

Read More

Introducing Shoelace, a Framework-Independent Component-Based UX Library | CSS-Tricks

[ad_1] This is a post about Shoelace, a component library by Cory LaViska, but with a twist. It defines all your standard UX components: tabs, modals, accordions, auto-completes, and much, much more. They look beautiful out of the box, are accessible, and fully customizable. But rather than creating these components in React, or Solid, or Svelte, etc., it creates them with Web Components; this means you can use them with

Read More

Adding Fluid Typography Support to WordPress Block Themes | CSS-Tricks

[ad_1] Fluid typography is a fancy way of “describing font properties, such as size or line height, that scale fluidly according to the size of the viewport”. It’s also known by other names, like responsive typography, flexible type, fluid type, viewport sized typography, fluid typography, and even responsive display text. Here is an example of fluid typography that you can play live (courtesy of MDN documentation). CSS-Tricks has covered fluid

Read More