Search
Global CSS options with custom properties
30.5.2020
With a preprocessor, like Sass, building a logical “do this or don’t” setting is fairly straightforward:
$option: false;
@mixin doThing {
@if $option {
do-thing: yep;
}
}
.el {
@include doThing;
}
Can we do that in native CSS with custom properties? Mark Otto shows...
How to Tame Line Height in CSS
15.5.2020
In CSS, line-height is probably one of the most misunderstood, yet commonly-used attributes. As designers and developers, when we think about line-height, we might think about the concept of leading from print design — a term, interestingly enough, that comes from literally putting pieces of lead...
CSS Animation Timelines: Building a Rube Goldberg Machine
12.5.2020
If you’re going to build a multi-step CSS animation or transition, you have a particular conundrum. The second step needs a delay that is equal to the duration of the first step. And the third step is equal to the duration of the first two steps, plus any delay in between. It gets more...
Getting JavaScript to Talk to CSS and Sass
3.4.2020
JavaScript and CSS have lived beside one another for upwards of 20 years. And yet it’s been remarkably tough to share data between them. There have been large attempts, sure. But, I have something simple and intuitive in mind — something not involving a structural change, but rather putting...
Programming Sass to Create Accessible Color Combinations
12.3.2020
We are always looking to make the web more accessible. Color contrast is just math, so Sass can help cover edge cases that designers might have missed.
The post Programming Sass to Create Accessible Color Combinations appeared first on CSS-Tricks
Sass !default and themeable design systems
11.3.2020
This is a great blog post from Brad Frost where he walks us through an interesting example. Let’s say we’re making a theme and we have some Sass like this:
.c-text-input {
background-color: $form-background-color;
padding: 10px
}
If the $form-background-color variable isn’t defined then...
Use and Reuse Everything in SVG… Even Animations!
28.1.2020
If you are familiar with SVG and CSS animations and started to work with them often, here are some ideas you might want to keep in mind before jumping into the job. This article will be about learning how to build and optimize your code with <use> element, CSS Variables and...
A Handy Sass-Powered Tool for Making Balanced Color Palettes
9.12.2019
For those who may not come from a design background, selecting a color palette is often based on personal preferences. Choosing colors might be done with an online color tool, sampling from an image, "borrowing" from favorite brands, or just sort of randomly picking from a color wheel until...
Collective #556
10.10.2019
Cascading Cache Invalidation * Top-level await * Introducing Sass Modules * cursorOS
Collective #556 was written by Pedro Botelho and published on Codrops
Introducing Sass Modules
7.10.2019
Sass just launched a major new feature you might recognize from other languages: a module system. This is a big step forward for @import. one of the most-used Sass-features. While the current @import rule allows you to pull in third-party packages, and split your Sass into manageable "partials,"...
A Proof of Concept for Making Sass Faster
17.9.2019
At the start of a new project, Sass compilation happens in the blink of an eye. This feels great, especially when it’s paired with Browsersync, which reloads the stylesheet for us in the browser. But, as the amount of Sass grows, compilation time increases. This is far from ideal.
It can be a real...
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...
Creating a Maintainable Icon System with Sass
28.8.2019
One of my favorite ways of adding icons to a site is by including them as data URL background images to pseudo-elements (e.g. ::after) in my CSS. This technique offers several advantages:
They don't require any additional HTTP requests other than the CSS file.
Using the background-size property...
Responzivní breakpointy: Realizace v kódu (CSS, Sass i PostCSS)
23.8.2019
Ukládání breakpointů a rozmezí do proměnných preprocesoru velmi doporučuji, protože to zpřehlední kód a zefektivní psaní. Příklady v článku využívají CSS preprocesoru Sass v SCSS syntaxi. Ale podíváme se také na PostCSS (a CSSnext) nebo očekávaný vývoj specifikací
Staggered CSS Transitions
14.8.2019
Let's say you wanted to move an element on :hover for a fun visual effect.
@media (hover: hover) {
.list--item {
transition: 0.1s;
transform: translateY(10px);
}
.list--item:hover,
.list--item:focus {
transform: translateY(0);
}
}
Cool cool. But what if you had several list...
React Starter: Adding Sass to Create React App Applications
17.5.2019
Adding Sass is one of the first things most developers do when starting an application. Writing in plain CSS can be done, but Sas
Getting To Know The MutationObserver API
8.5.2019
MutationObserver watches the DOM, specifically the places you tell it to, like:
document.querySelector('#watch-this');
...and it can tell you (trigger a callback) when stuff happens — like when a child is added, removed, changed, or a number of other things.
I used it just the other day...
Do CSS Custom Properties Beat Sass Loops?
2.3.2019
I reckon that a lot of our uses of Sass maps can be replaced with CSS Custom properties – but hear me out for a sec.
When designing components we often need to use the same structure of a component but change its background or text color based on a theme. For example, in an alert, we might need...
Where Do You Nest Your Sass Breakpoints?
11.2.2019
I love nesting my @media query breakpoints. It's perhaps the most important feature of Sass to me. Maybe I pick a method and do it like this:
.element {
display: grid;
grid-template-columns: 100px 1fr;
@include breakpoint(baby-bear) {
display: block;
}
}
That's straightforward enough....
Sass Techniques from the Trenches
8.1.2019
Having been in the web development industry for more than 14 years, I’ve seen and written my fair share of good and bad CSS. When I began at Ramsey Solutions five years ago, I was introduced to Sass. It blew my mind how useful it was! I dove right in and wanted to learn everything I could about...