#CssVariables

Ana Tudor ๐Ÿฏanatudor
2025-12-26

Pure demo on @codepen: polyhedra morphing sequence codepen.io/thebabydino/pen/abm

Absolutely no magic numbers, everything computed.

See Pen description for the how behind ๐Ÿ˜ผ

Ana Tudor ๐Ÿฏanatudor
2025-12-17

A little @codepen demo: resizable panels with draggable panel separators codepen.io/thebabydino/pen/gbP

Hopefully at least more accessible than the alternatives. The description has info about my testing this thing.

Demo screenshot. Shows three panels, two at the top, separated by the bottom one using one separator and separated between them using another separator.
Hacker Newsh4ckernews
2025-11-25
Ana Tudor ๐Ÿฏanatudor
2025-10-31

I have a new article out!

Super Simple Full-Bleed & Breakout Styles
frontendmasters.com/blog/super - my take on an old problem using modern CSS solutions.

Using a spooky made up Halloween recipe to illustrate concepts.

PS @chriscoyier told me to be proud of it ๐Ÿ˜›

Ana Tudor ๐Ÿฏanatudor
2025-10-31


How would you do this? A gradient tinted image, the gradient tint gradually disappearing from left to right on hover, then coming back from left to right on exit.

โœจ single `img` elem (so no pseudos)
โœณ๏ธ cross-browser
๐Ÿšซ no JS
๐Ÿšซ no SVG filter

Ana Tudor ๐Ÿฏanatudor
2025-10-29

There are n equally sized items arranged in half a circle on the left, from top to bottom, with the same gap g in between. How do you do it? Cross-browser, same (โ‰ค20 declarations) should work when changing their number/ gap.

Try to code it yourself before checking my solution reddit.com/r/Frontend/comments

Live on @codepen: codepen.io/thebabydino/pen/ZYQ

Screenshot. Shows 20 equally sized items arranged in half a circle (from 12 o'clock to 6 o'clock) on the left viewport side. The very first touches the left and top viewport edges. The very last touches the left and bottom viewport edges. There is a little gap in between them, exact same gap between all of them.
Ana Tudor ๐Ÿฏanatudor
2025-09-01

For all Ko-fi/ Patreon supporters...

First off, thank you for supporting my work and helping me stay afloat!

And second, something new dropped today...

โœจ ko-fi.com/post/Blobby-reveal-o

โœจ patreon.com/posts/blobby-revea

PS: hope you like SVG filters because there's more cooking/ coming soon. Next thing *very* soon because it's functional (even if not pretty yet) & dying to share it.

2025-08-09

ใใ—ใฆใ“ใ†ใชใฃใฆใใ‚‹ใจใ€#Tailwind ใฏใ‚‚ใ† #CSSVariables ใ ใ‘ใงใ„ใ„ใ‚“ใ˜ใ‚ƒใชใ„๏ผŸใจใ„ใ†ๆฐ—ๆŒใกใซใ‚‚ใชใฃใฆใ€ใ ใฃใŸใ‚‰ #OpenProps ใฎใปใ†ใŒไฝฟใ„ใ‚„ใ™ใ„ใ‚“ใ ใ‚ˆใชใƒผใจใ„ใ†ๆฐ—ๆŒใกใŒใ‚ใ‚‹

Open Props: sub-atomic styles
open-props.style/

Wie verwendet man CSS Variablen (CSS & HTML & Javascript - Anleitung / Tutorial]

video.maechler.cloud/w/c8AkMdk

Starbeamrainbowlabssbrl@fediscience.org
2025-07-08

It's definitely not perfect but I made a thing! It's a shiny card effect ๐ŸŽด with 3d perspective, done in mostly-pure CSS with a bit of Javascript for cursor positions etc.

๐Ÿ“ฑ Doesn't work very well on mobile at the moment though - it's on my todo list.

In other news, CSS container queries are both fun, useful, and confusing. ๐Ÿ“ฆ๐Ÿ“ฆ๐Ÿ“ฆ

starbeamrainbowlabs.com/labs/s

#HowDoITag #IDontEvenKnowIJustPostHere #Noodling #WebNoodling #NoodlingAround #CSS #CssVariables #WereUsed #AndAbused #CSS3D

Ana Tudor ๐Ÿฏanatudor
2025-06-24

So what else could we do? Use an SVG filter!โœจ

Set the gradient as one with two end stops and no steps and apply a super simple (same idea as here mastodon.social/@anatudor/1147 ) that makes it stepped.

Works for all gradient types - see this @codepen demo codepen.io/thebabydino/pen/raV ๐Ÿ˜ผ

Different types of gradients (linear, radial, conic) turned stepped via a simple SVG `filter`.
Ana Tudor ๐Ÿฏanatudor
2025-06-24

Using CSS variables solves both these problems, but we cannot use variables inside the `mix()` function, we have to use the CSS `color-mix()`. This means the compiled output looks way uglier.

You can check it out in this @codepen demo codepen.io/thebabydino/pres/bN

Screenshot of the modified Sass mixin using CSS variables and `color-mix()`. On the right, we also have a DevTools panel open, showing the changing one of the end steps changes all intermediary ones this way.```
@use 'sass:math';

// $n: number to round to a certain precision
// $p: rounding precision, how many decimals to keep
@function round-to($n, $p: 2) {
	@return round($n*math.pow(10, $p))*math.pow(10, -$p)
}

// $c0: gradient start
// $c1: gradient end
// $n: number of steps
// $p: rounding precision, how many decimals to keep
@function stop-list($c0, $c1, $n, $p: 2) {
	$l: (); // list of stops
	
	@for $i from 0 to $n {
		$l: $l, 
				if($i > 0, 
					if($i < $n - 1, 
						color-mix(in srgb, $c1 round-to($i*100%/($n - 1), $p), $c0), 
						$c1), 
					$c0) 
		// 1st stop position for each stop
		// not set (empty '') for very first stop
		    if($i > 0, 0, unquote('')) 
		// 2nd stop position for each stop
		// not set (empty '') for very last stop
		    if($i < $n - 1, round-to(($i + 1)*100%/$n, $p), unquote(''))
	}
	
	@return $l
}

p {
	background: linear-gradient(90deg, stop-list(var(--c0), var(--c1), 10))
}
```

```
p {
	background: linear-gradient(90deg, 
			var(--c0) 10%, 
			color-mix(in srgb, var(--c1) 11.11%, var(--c0)) 0 20%, 
			color-mix(in srgb, var(--c1) 22.22%, var(--c0)) 0 30%, 
			color-mix(in srgb, var(--c1) 33.33%, var(--c0)) 0 40%, 
			color-mix(in srgb, var(--c1) 44.44%, var(--c0)) 0 50%, 
			color-mix(in srgb, var(--c1) 55.56%, var(--c0)) 0 60%, 
			color-mix(in srgb, var(--c1) 66.67%, var(--c0)) 0 70%, 
			color-mix(in srgb, var(--c1) 77.78%, var(--c0)) 0 80%, 
			color-mix(in srgb, var(--c1) 88.89%, var(--c0)) 0 90%, 
			var(--c1) 0)
}
```
Ana Tudor ๐Ÿฏanatudor
2025-06-18

A little something on @codepen: pure icosphere of spheres codepen.io/thebabydino/pen/poY

Very little code and I should be able to make the algorithm even more efficient. Pure CSS shading too.

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

Client Info

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