Search
CSS Functions and Mixins Module Notes
31.7.2024
Most days, I’m writing vanilla CSS. Thanks to CSS variables and nesting, I have fewer reasons to reach for Sass or any other preprocessor. The times I reach for Sass tend to be when I need a @mixin to loop …
CSS Functions and Mixins Module Notes originally published on CSS-Tricks...
State of CSS 2022 Survey Now Open
4.10.2022
The State of CSS survey recently opened up. Last year, the survey confirmed everyone’s assumptions that TailwindCSS is super popular and CSS variables are mainstream. It also codified what many of us want from CSS, from Container Queries to …
State of CSS 2022 Survey Now Open...
Named Element IDs Can Be Referenced as JavaScript Globals
27.9.2022
Did you know that DOM elements with IDs are accessible in JavaScript as global variables? It’s one of those things that’s been around, like, forever but I’m really digging into it for the first time.
If this is the first …
Named Element IDs Can Be Referenced as JavaScript Globals originally...
Interpolating Numeric CSS Variables
30.8.2022
We can make variables in CSS pretty easily:
:root {
--scale: 1;
}
And we can declare them on any element:
.thing {
transform: scale(--scale);
}
Even better for an example like this is applying the variable on a user …
Interpolating Numeric CSS Variables originally published...
Coinbase Says Idiosyncratic Variables Still Impacting Crypto Returns
13.4.2022
This supports the use of digital assets for portfolio diversification, the report said
Quick and Dirty Bootstrap Overrides at Runtime
10.11.2021
Oh, Bootstrap, that old standard web library that either you hate or you spend all your time defending as “it’s fine, it’s not that bad.” Regardless of what side you fall on, it’s a powerful UI framework that’s everywhere, …
The post Quick and Dirty Bootstrap Overrides at Runtime appeared...
Using Absolute Value, Sign, Rounding and Modulo in CSS Today
28.7.2021
For quite a while now, the CSS spec has included a lot of really useful mathematical functions, such as trigonometric functions (sin(), cos(), tan(), asin(), acos(), atan(), atan2()), exponential functions (…
The post Using Absolute Value, Sign, Rounding and Modulo in CSS Today appeared...
The Dilemma of Naming Font Size Variables
6.7.2021
Normally, a project will have a set of pre-determined font sizes, usually as variables named in such a way that seeks some semblance of order and consistency. Any project of considerable size can use something like that. There are always …
The post The Dilemma of Naming Font Size Variables...
Hack the “Deploy to Netlify” Button Using Environment Variables to Make a Customizable Site Generator
1.7.2021
If you’re anything like me, you like being lazy shortcuts. The “Deploy to Netlify” button allows me to take this lovely feature of my personality and be productive with it.
Clicking the button above lets me (or you!) instantly …
The post Hack the “Deploy...
A Complete Guide to Custom Properties
27.4.2021
Everything important and useful to know about CSS Custom Properties. Like that they are often referred to as "CSS Variables" but that's not their real name.
The post A Complete Guide to Custom Properties appeared first on CSS-Tricks.
You can support CSS-Tricks by being an MVP Supporter
Flash of inAccurate coloR Theme (FART)
16.4.2021
There is a lot to think about when implementing a dark mode theme on a website. We have a huge guide on it. There are some very clever quick wins out there, but there are also some quite tricky things …
The post Flash of inAccurate coloR Theme (FART) appeared first on CSS-Tricks.
You...
CSS is a Strongly Typed Language
13.4.2021
One of the ways you can classify a programming language is by how strongly or weakly typed it is. Here, “typed” means if variables are known at compile time. An example of this would be a scenario where an integer …
The post CSS is a Strongly Typed Language appeared first on CSS-Tricks.
You...
Platform News: Rounded Outlines, GPU-Accelerated SVG Animations, How CSS Variables Are Resolved
2.4.2021
In the news this week, Firefox gets rounded outlines, SVG animations are now GPU-accelerated in Chrome, there are no physical units in CSS, The New York Times crossword is accessible, and CSS variables are resolved before the value is inherited.…
The post Platform News: Rounded Outlines...
Want to Write a Hover Effect With Inline CSS? Use CSS Variables.
26.3.2021
The other day I was working on a blog where each post has a custom color attached to it for a little dose of personality. The author gets to pick that color in the CMS when they’re writing the post. …
The post Want to Write a Hover Effect With Inline CSS? Use CSS Variables. appeared first...
Use CSS Variables instead of React Context
19.2.2021
Turns out you can use several different libraries to pass color information around components. Or, you could use custom properties, built right into CSS, have no decline in your own developer experience, and deliver a faster experience to your users. …
The post Use CSS Variables instead...
Give your Eleventy Site Superpowers with Environment Variables
31.12.2020
Eleventy is increasing in popularity because it allows us to create nice, simple websites, but also — because it’s so developer-friendly. We can build large-scale, complex projects with it, too. In this tutorial we’re going to demonstrate that expansive capability …
The post Give your...
The CSS Custom Property Toggle Trick
29.10.2020
Back in July 2020, I got an email from James0x57 (I always try to refer to people by their name, but I think I get the sense they prefer to go by screen name) that says:
The entire world of branching conditional logic and bulk feature toggling for custom CSS properties is possible and only exists...
Collective #626
8.10.2020
With Code * CSS Grid full-bleed layout tutorial * Why Tailwind CSS * CSS Variables 101
The post Collective #626 appeared first on Codrops
The Cicada Principle, revisited with CSS variables
5.8.2020
Lea Verou digging up the CSS trickery classic and applying it to clip the backgrounds of some code blocks:
The main idea is simple: You write your main rule using CSS variables, and then use :nth-of-*() rules to set these variables to something different every N items. If you use enough...
Global and Component Style Settings with CSS Variables
1.7.2020
The title of this Sara Soueidan article speaks to me. I’m a big fan of the idea that some CSS is best applied globally, and some CSS is best applied scoped to a component. I’m less interested in how that is done and more interested in just seeing that conceptual approach used in some...