Menu

CSS

Creating Color Themes With Custom Properties, HSL, and a Little calc()

April 16th, 2020

Before the advent of CSS custom properties (we might call them “variables” in this article as that’s the spirit of them), implementing multiple color schemes on the same website usually meant writing separate stylesheets. Definitely not the most maintainable thing in the world. Nowadays, though, we can define variables in a single stylesheet and let…

CSS Scrollbar With Progress Meter

April 15th, 2020

Scrollbars are natural progress meters. How far the scrollbar is down or across is how much progress has been made scrolling through that element (often the entire page). But, they are more like progress indicators than meters, if you think of a meter as something that “fills up” as you go. We can use some…

Create a Responsive CSS Motion Path? Sure We Can!

April 15th, 2020

There was a discussion recently on the Animation at Work Slack: how could you make a CSS motion path responsive? What techniques would be work? This got me thinking. A CSS motion path allows us to animate elements along custom user-defined paths. Those paths follow the same structure as SVG paths. We define a path…

Using CSS to Set Text Inside a Circle

April 14th, 2020

You want to set some text inside the shape of a circle with HTML and CSS? That’s crazy talk, right? Not really! Thanks to shape-outside and some pure CSS trickery it is possible to do exactly that. However, this can be a fiddly layout option. We have to take lots of different things into consideration,…

Styling in the Shadow DOM With CSS Shadow Parts 

April 13th, 2020

Safari 13.1 just shipped support for CSS Shadow Parts. That means the ::part() selector is now supported in Chrome, Edge, Opera, Safari, and Firefox. We’ll see why it’s useful, but first a recap on shadow DOM encapsulation… The benefits of shadow DOM encapsulation I work at giffgaff where we have a wide variety of CSS…

Thinking in Behaviors, Not Screen Sizes

April 10th, 2020

Chase McCoy wrote a nifty post about the “gap problem” when making a grid of items. His argument might be summarized like this: how should we space elements with margins in CSS? He notes that the gap property isn’t quite ready for prime time when it comes to using it with flexbox, like this: .grid…

CSS Foldable Display Polyfill

April 9th, 2020

Foldable phones are starting to be a thing. Early days, for sure, but some are already shipping, and they definitely have web browsers on them. Stands to reason that, as web designers, we are going to want to know where that fold is so we can design screens that fit onto the top half and…

Create Diagonal Layouts Like it’s 2020

April 9th, 2020

Nils Binder covers the ways: 1. Use an SVG in the form of a triangle. This technique is nicely described by Erik Kennedy on CSS-Tricks. 2. Hide part of your section using clip-path. Read Diagonal Containers in CSS by Sebastiano Guerriero or Sloped edges with consistent angle in CSS by Kilian Valkhof. 3. Using CSS Transforms I would normally be…

How to Re-Create a Nifty Netflix Animation in CSS

April 7th, 2020

The design for Netflix’s browse page has remained pretty similar for a few years now. One mainstay component is the preview slider that allows users to scroll through content and hover on items to see a preview. One unique characteristic of the UI is its hover behavior. When a show preview expands on hover, the…

CSS Findings From The New Facebook Design

April 7th, 2020

Ahmad Shadeed digs around the new Facebook’s front-end code. One that stood out to me: .element { inset: 4px 0; /* Which is equivalent to: top: 4px, bottom: 4px, left: 0, right: 0 */ } Whaaat? This is the first I’ve heard of the inset property. Ahmad said he saw it working in Chrome 80,…