Search

Nalezeno "Sass": 45

Global CSS options with custom properties


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


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


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


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


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


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!


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


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


Cascading Cache Invalidation * Top-level await * Introducing Sass Modules * cursorOS Collective #556 was written by Pedro Botelho and published on Codrops

Introducing Sass Modules


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


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


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


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)


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


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...

Getting To Know The MutationObserver API


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?


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?


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


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...

Nahoru
Tento web používá k poskytování služeb a analýze návštěvnosti soubory cookie. Používáním tohoto webu s tímto souhlasíte. Další informace