#cssvariables

As a #CSS amateur, I've always just hard coded my colours the traditional way. While working on a light and dark theme switcher on my Hugo blog, I learnt the proper way to do it using the var() function and defining a css variables, e.g. `var(--light-blue)`. I can easily and happily change colours in my theme in the future!

Plus, I get to clean up my custom.css file which got ugly quick from all the random customizations I've been making.

#Hugo #hugossg #cssvariables #blogging

Ana Tudor 🐯anatudor
2025-05-13

Because somebody hearted this demo I made 7 years ago on @codepen and it hit me I've never shared it here: pure 1 div animated 🌈 ∞ logo

codepen.io/thebabydino/pen/zRZ

Ana Tudor 🐯anatudor
2025-05-13

I turn 13 on @codepen in June, so here are my 13 most hearted demos:

1️⃣ 1092 ♥️ infinite gallery codepen.io/thebabydino/pen/XJr - my only demo to ever get to 1K ♥️ without being in most hearted of the year first

mostly CSS scroll-driven animations + tiniest bit of JS (~200 bytes for infinity part)

Ana Tudor 🐯anatudor
2025-05-09

Because someone asked for this on reddit: an image that shows when hovering a nav item, under that nav item, but above all others and follows the pointer motion reddit.com/r/css/comments/1kgp

Live on @codepen
codepen.io/thebabydino/pen/azz

Uses a tiny bit of until we can get the pointer position in pure - see this proposal by @bramus github.com/w3c/csswg-drafts/is

2025-04-22

#CSSVariables をはじめ #CSS まわりの最近の進化はほんともっと注目されてよいと思っている。

#CSS ってなんか最近のフロントエンドでも「低レイヤーの話」みたいになっちゃってて、目新しいフレームワークっぽいシャレた名前もない「 #CSS の新機能!」っていっても、なんかいまいち盛り上がりきらない感があるような気がするんだけど、 #CSS はいま素で書くだけでもすごい強力になってきている(むしろフレームワークに寄らずに素の CSS 書きたい気持ちすらある

2025-04-22

#Misskey :misskey: の中の人が #CssVariables とか #RelativeColorSyntax について書いてくれてとても俺得な記事だった :amaze:
最近はここに #oklch 関数も組み込めるので、さらに進化が進んでいる…

CSS Variablesはここまで進化した
gihyo.jp/article/2025/04/missk

Ana Tudor 🐯anatudor
2025-04-15

A fun little scroll-driven thing I made. The text is white over the image, but the image isn't static, it rotates on scroll. 😼

Here's a detailed explanation of the how behind reddit.com/r/css/comments/1jyu

Live on @codepen codepen.io/thebabydino/pen/dPP

Also uses container queries, CSS trigonometric functions.

2025-04-14

* 🎨 明度・彩度・色相もそれぞれ変数化できる #CssVariables
* 🧮 特定の色を相対的に変化可能な #RelativeColorSyntax
* 🌈 色をより人間の知覚に近い形で扱える #oklch

このあたりは、現存するどのデザインツールよりも、現在のブラウザーで使える #CSS の機能のほうが柔軟で拡張性が高い。

…あれ、ということはやっぱり最強のデザインツールは #CSS なのでは :vivaldia_1:

Ana Tudor 🐯anatudor
2025-03-28

Flip card on hover, flip back on hover out...

... but on touchscreens, flip it on click and then flip it back on second click!

A mostly solution, using transforms, variables, grid, pointer MQ + a little bit of .

Because somebody asked how to do it reddit.com/r/css/comments/1jm0

Live demo on @codepen: codepen.io/thebabydino/pen/MYW

Ana Tudor 🐯anatudor
2025-03-17

Because I saw a @codepen demo creating a hex grid using my well over a decade old nested and reverted transforms technique to get the shape + MQs...

Here's a super simple modern grid + clip-path + mathematical functions responsive version with no breakpoints codepen.io/thebabydino/pen/QwW

Screenshot of linked demo with DevTools open, highlighting the main grid and showing there are no media queries at play.
Ana Tudor 🐯anatudor
2025-03-04

No JS animation. The animation is created in , where I'm animating the values of two custom properties back and forth. `feTurbulence` creates the background, `feDisplacement` map uses the CSS-animated input to make it move.

My take on this question reddit.com/r/webdev/comments/1

Ana Tudor 🐯anatudor
2025-02-24

My most popular demo of 2024. By far. My second most hearted @codepen demo ever.

codepen.io/thebabydino/pen/WNV

Pure , single div, very little code overall; and that's even including layout, prettifying & animation styles. Oh, heavily commented too.

Screenshot of the details page on CodePen, showing it hearted 999 times and viewed 19824 times.
Ana Tudor 🐯anatudor
2025-02-22

I haven't used style queries much, but just gave them a spin and got an idea (that I've just tested & works) about how we can have ranges in style queries right now. 🥳

That is, red background if --k <= 20, orange background if 20 < --k <= 40 and so on...

Screenshot of a basic test for ranges n style queries.
pablolarahpablolarah
2025-02-06

🥤 Pure CSS Mixin for Displaying Values of Custom Properties
by Roman Komarov @kizu

kizu.dev/preview-mixin/

Red text "Pure CSS Mixin for Displaying Values of Custom Properties" with medium pink background on light pink background with illustrated magnifying glass on bottom right
2025-01-21

🎉 Join our Webinar: CSS Custom Properties – Your Modern Web Dev Superpower!
📅 Date: Thu, Jan 30, 2025
⏰ Time: 3:30 PM - 4:30 PM CET
🚀 Speaker: Nazarii Banakh
🔍 What you'll learn:
✅ CSS variables (syntax, scope, best practices).
✅ Flexible style management & maintainable code.
✅ Dynamic themes & adaptive designs.
✅ Real-world examples for effective implementation.
Perfect for devs & designers looking to upskill!
👉 Register now: share-eu1.hsforms.com/1hjk_Mju
#CSS #WebDevelopment #CSSVariables

Ana Tudor 🐯anatudor
2025-01-13

Here's a little thing I made for the 1st of '25: pure tilt & zoom grid on scroll!

Check it out on @codepen

codepen.io/thebabydino/pen/jEN

Using pure CSS scroll driven animations, grid, variables, mathematical functions, container query units. Also uses an SVG filter for the dissolve effect.

Chromium only.

Ana Tudor 🐯anatudor
2025-01-07

Made this loader codepen.io/thebabydino/pen/Bay half a decade ago. Then it only worked in Chromium browsers with the Experimental Web Platform features flag enabled.

As of 2024, it works cross-browser, no flags needed. Since someone hearting it reminded me of its existence, updated support info.

Ana Tudor 🐯anatudor
2025-01-03

Saw youtube.com/watch?v=An3QMWg3m1c linked last evening & gave the challenge a quick go myself.

My approach was a mostly one, with minimal HTML (no extra wrappers) and JS (used only to update top item index, ~200 bytes minified).

While it was working, it wasn't pretty, so today I polished the demo & heavily commented the CSS - check it out on @codepen: codepen.io/thebabydino/pen/jEN

2024-12-12

applying a flexible #CSS z-index stack fixed a lot of messy legacy layering issues for me. There might be better ways, but this is very readable when applied, some examples:

.is-sticky {
position: sticky;
z-index: var(--above-page-z);
}

.notification {
z-index: var(--alert-z);
}

#UI #CssVariables #zindex

CSS code:
   --z-stack: 10; // gap between stacks
    // use 'above' and 'below' for "just above" or "just below" a stack
    --above-z: 1;
    --below-z: -1;

    --page-z: calc(var(--z-stack) * 0);
    --above-page-z: calc(var(--above-z) + var(--page-z));
    --below-page-z: calc(var(--below-z) + var(--page-z));

    // floating palettes and sidebars
    --palette-z: calc(var(--z-stack) * 1);
    --above-palette-z: calc(var(--above-z) + var(--alert-z));
    --below-palette-z: calc(var(--below-z) + var(--alert-z));

    // popup alerts and toast notifications
    --alert-z: calc(var(--z-stack) * 2);
    --above-alert-z: calc(var(--above-z) + var(--alert-z));

    // Modal window
    --modal-z: var(--bulma-modal-z, var(--z-stack) * 3);
    --above-modal-z: calc(var(--above-z) + var(--bulma-modal-z));
    --below-modal-z: calc(var(--below-z) + var(--bulma-modal-z));
2024-11-23

#TailwindCSS の設定が #JS ではなく #CSS からできるようになるらしい。
#OpenProps とかで見慣れた #CSS変数 #CSSVariables で設定を上書きするスタイル。

tailwindcss.com/docs/v4-beta#c

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst