Search
A Complete Guide to calc() in CSS
17.3.2020
CSS has a special calc() function for doing basic math. Here's an example:
.main-content {
/* Subtract 80px from 100vh */
height: calc(100vh - 80px);
}
In this guide, let's cover just about everything there is to know about this very useful function.
calc() is for values
The only place you...
How to Make a Line Chart With CSS
11.3.2020
Line,  bar, and pie charts are the bread and butter of dashboards and are the basic components of any data visualization toolkit. Sure, you can use SVG or a JavaScript chart library like Chart.js or a complex tool like D3 to create those charts, but what if you don't want to load yet another...
Custom Styling Form Inputs With Modern CSS Features
7.2.2020
It’s entirely possible to build custom checkboxes, radio buttons, and toggle switches these days, while staying semantic and accessible. We don’t even need a single line of JavaScript or extra HTML elements! It’s actually gotten easier lately than it has been in the past. Let’s take a look.
Here’s...
The Web in 2020: Extensibility and Interoperability
22.1.2020
In the past few years, we’ve seen a lot of change and diversion in regard to web technologies. In 2020, I foresee us as a web community heading toward two major trends/goals: extensibility and interoperability. Let’s break those down.
Extensibility
Extensibility describes...
Thinking Through Styling Options for Web Components
16.1.2020
Where do you put styles in web components?
I'm assuming that we're using the Shadow DOM here as, to me, that's one of the big draws of a web component: a platform thing that is a uniquely powerful thing the platform can do. So this is about defining styles for a web component in a don't-leak-out...
Multi-Thumb Sliders: General Case
8.1.2020
The first part of this two-part series detailed how we can get a two-thumb slider. Now we'll look at a general multi-thumb case, but with a different and better technique for creating the fills in between the thumbs. And finally, we'll dive into the how behind the styling a realistic 3D-looking...
Multi-Thumb Sliders: Particular Two-Thumb Case
7.1.2020
This is a concept I first came across a few years back when Lea Verou wrote an article on it. Multi-range sliders have sadly been removed from the spec since, but something else that has happened in the meanwhile is that CSS got better — and so have I, so I recently decided to make my...
7 Uses for CSS Custom Properties
27.12.2019
I find all seven of these quite clever and useful.
I particularly like using custom properties when you can sneak a variation into a place where you'd normally have to re-declare a whole big chunk of code.
.some-element {
background-color: hsla(
var(--h, 120),
var(--s, 50),
var(--l...
Moving Rainbow Underlines
23.12.2019
I absolutely love the design of the Sandwich site. Among many beautiful features are these headlines with rainbow underlines that move as you scroll. It's not scroll-jacking — it's just a minor design feature that uses scroll position to enact a little movement.
To draw the rainbows...
Stream-Crossing Confusion
23.12.2019
Should I use WordPress or React hooks?
Should I use D3 or CSS?
Should I use Markdown or JSON?
Can I use flexbox in Gatsby?
Can I use custom properties in Jekyll?
Should I use HTML or the cloud?
How do I add dark mode to my Vue site?
These are tongue-in-cheek, but there is a point to be made here....
The Power (and Fun) of Scope with CSS Custom Properties
27.11.2019
You’re probably already at least a little familiar with CSS variables. If not, here’s a two-second overview: they are really called custom properties, you set them in declaration blocks like --size: 1em and use them as values like font-size: var(--size);, they differ from preprocessor variables...
Patterns for Practical CSS Custom Properties Use
9.10.2019
I've been playing around with CSS Custom Properties to discover their power since browser support is finally at a place where we can use them in our production code. I’ve been using them in a number different ways and I’d love for you to get as excited about them as I am. They are so useful...
Using Custom Properties to Wrangle Variations in Keyframe Animations
12.9.2019
Have you ever wondered how to customize CSS animations keyframes without using any preprocessor feature, like mixins? I keep reaching for preprocessors for this reason, but it would so nice to drop yet one more dependency and go with vanilla CSS.
Well, I found a way to account for variations within...
Logical Operations with CSS Variables
11.9.2019
Very often, while using switch variables (a variable that's either 0 or 1, a concept that's explained in a greater detail in in this post), I wish I could perform logical operations on them. We don't have functions like not(var(--i)) or and(var(--i), var(--k)) in CSS, but we can emulate these...
Contextual Utility Classes for Color with Custom Properties
14.8.2019
In CSS, we have the ability to access currentColor which is tremendously useful. Sadly, we do not have access to anything like currentBackgroundColor, and the color-mod() function is still a ways away.
With that said, I am sure I am not alone when I say I'd like to style some links based on...
Weekly news: Truncating muti-line text, calc() in custom property values, Contextual Alternates
26.7.2019
In this week's roundup, WebKit's method for truncating multi-line text gets some love, a note on calculations using custom properties, and a new OpenType feature that prevents typographic logjams.
The post Weekly news: Truncating muti-line text, calc() in custom property values, Contextual...
Managing Multiple Backgrounds with Custom Properties
15.7.2019
One cool thing about CSS custom properties is that they can be a part of a value. Let's say you're using multiple backgrounds to pull off a a design. Each background will have its own color, image, repeat, position, etc. It can be verbose!
You have four images:
body {
background-position:
...
Weekly Platform News: HTML Inspection in Search Console, Global Scope of Scripts, Babel env Adds defaults Query
11.7.2019
In this week's look around the world of web platform news, Google Search Console makes it easier to view crawled markup, we learn that custom properties aren't computing hogs, variables defined at the top-level in JavaScript are global to other page scripts, and Babel env now supports the defaults...
Different Approaches for Creating a Staggered Animation
27.6.2019
Animating elements, at its most basic, is fairly straightforward. Define the keyframes. Name the animation. Call it on an element.
But sometimes we need something a little more complex to get the right “feel" for the way things move. For example, a sound equalizer might use the same animation...
Different Approaches for Creating a Staggered Animation
27.6.2019
Animating elements, at its most basic, is fairly straightforward. Define the keyframes. Name the animation. Call it on an element.
But sometimes we need something a little more complex to get the right “feel" for the way things move. For example, a sound equalizer might use the same animation...