#tinyCSStip
Nowadays, we can do better:

```
box-shadow: 0 1px 2px
rgb(from currentcolor r g b/ .65)
```

Cross-browser since September 2024.

#tinyCSStip #CSS
#tinyCSStip

Want the shadow of an element or some other visual to be a semitransparent version of the `currentColor`?

Use `color-mix()`!

Cross-browser, btw. 😼
November 22, 2025 at 3:24 PM
#tinyCSStip Want your page background to contain an integer number of dots?

Use `background-repeat: space`! This inserts a bit of space in between background repetitions so we have an integer number of them. Well-supported for ages. 🥳

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

#CSS #pattern
November 13, 2024 at 7:08 AM
#tinyCSStip

`:is()` is such a great new-ish #CSS feature that helps eliminate repetition in selectors ✨
October 23, 2024 at 9:02 AM
#tinyCSStip

I like shorthands, I find them immensely useful. But it doesn't always make sense to drop it all in the shorthand and having repetitions. Yeah, you can store that `.2s` in a #CSS variable. But is it really worth it if you're not even using it elsewhere in addition to not being dynamic?
April 30, 2026 at 9:17 AM
#tinyCSStip

Pretty sure I've posted about this before, but a quick search at this hour didn't find it, plus saw someone ask about it yet again¹, so... fixed aspect-ratio box within variable size container!

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

¹here www.reddit.com/r/css/commen...

#CSS
December 19, 2024 at 6:30 AM
#tinyCSStip We can have boolean logic in container queries!

And this works cross-browser!

Live test on @codepen.io: codepen.io/thebabydino/...

More info on @developer.mozilla.org: developer.mozilla.org/en-US/docs/W...

#CSS
June 1, 2025 at 6:20 AM
#tinyCSStip

Sometimes, if you notice a teeny tiny misalignment and you cannot understand why because *nothing* in your CSS looks like it could have caused it... try using `round()` to round to an integer number of pixels.

It just solved my own tiny misalignment problem that was driving me batty. 🦇
April 28, 2026 at 5:15 PM
#tinyCSStip
Want the shadow of an element or some other visual to be a semitransparent version of the `currentColor`, which was given as a hex or keyword value?

No need to convert to rgb() or hsl() anymore!

#CSS
November 20, 2024 at 8:24 AM
Also, those letters in the squares? #CSS counters!

```
.item { counter-increment: c }

.item::after { content: counter(c, upper-alpha) }
```

#tinyCSStip
February 20, 2025 at 2:38 PM
#tinyCSStip

Range input browser inconsistencies may mean needing different styles for different browsers. Possible for track & thumb via different pseudos, but what about the actual range input?

Well, `@​supports selector()` to the rescue!

Live test on @codepen.io codepen.io/thebabydino/...

#CSS
November 20, 2024 at 8:42 AM
#tinyCSStip

How varying clip-path: inset() from the right element edge can help with a left to right reveal effect

✨ when this inset is 100%, all gets cut off
✨ when this inset is 0%, nothing gets cut off

Interactive illustration codepen.io/thebabydino/... + 🆒 pure #CSS on scroll use case 👇
November 20, 2024 at 6:55 AM
#tinyCSStip One thing that has always annoyed me about `:empty` is that it doesn't work for elements that have text content, but no element children.

`:has()` fixes this problem.

`:not(:has(*))` selects elements that don't have element children, even if they have text content.
March 12, 2024 at 9:18 AM
#tinyCSStip Create a fancy double border with dashes in between without any pseudos and with minimal #CSS!

The relevant code is just 3 simple CSS declarations!

Live demo on @codepen.io: codepen.io/thebabydino/...
January 13, 2025 at 5:25 PM
#tinyCSStip As I just saw this in a '24 tutorial to make an absolutely positioned pseudo extend `8px` outside its parent in all directions.

❌ DON'T 🙀
width: 100%; height: 100%;
left: 50%; top: 50%;
translate: -50% -50%;
padding: 8px

✅ DO 😼 (1 declaration, not 6)
inset: -8px

#CSS
August 24, 2024 at 9:35 PM
#tinyCSStip Want to avoid ugly checkerboard edges when the pattern size --s depends on viewport?

Round it to be a multiple of 2px so every square edge is an int number of pixels!

--s: round(10vmin, 2px);
background:
repeating-conic-gradient(red 0% 25%, tan 0% 50%)
0 0/ var(--s) var(--s)

#CSS
January 9, 2025 at 10:05 AM
#tinyCSStip if you want to make an absolutely positioned pseudo cover its parent's entire `padding-box`, use `inset: 0`!

(love grid for stacking/ full coverage too, but there are differences between how the two solutions work and there are cases when absolute positioning is still preferable)

#CSS
January 10, 2025 at 8:46 AM
#tinyCSStip
Revert animated parent transform (like a scale or skew) on child without an extra animation using registered custom properties.

codepen.io/thebabydino/...

#CSS
March 23, 2025 at 6:55 PM
#tinyCSStip Don't use many decimals in keyframe percentages to abruptly change a value. That's what the `steps()` timing function is for!

#CSS
November 18, 2024 at 9:23 PM
Because I often see this and it's a major #CSS pet peeve of mine, makes me want to scream "do you even understand what `cover` does?" at the screen every time...

#tinyCSStip
October 17, 2025 at 7:34 PM
#tinyCSStip Simplifying animations with variables and mathematical functions.

Same result, just not writing almost the same `text-shadow` a bunch of times in a bunch of keyframes.

Live test on @codepen.io: codepen.io/thebabydino/...

#CSS #Maths
March 24, 2025 at 8:43 AM
#tinyCSStip Double stop position is well-supported and has been well-supported for about half a decade, so there's no reason not to use it!

❌ DON'T 😬
orange 40%, hotpink 0, hotpink 60%, purple 0

✅ DO 😎
orange 40%, hotpink 0 60%, purple 0

Also see:
codepen.io/thebabydino/...

#CSS
September 26, 2024 at 2:54 PM
Basic #tinyCSStip.💡

So you have a responsive, flexible `width` rectangular box with `aspect-ratio: 2` and want to turn it into a half disc?

Use a `50%` horizontal `border-radius` and a vertical one that's `100%` for the top corners (first two listed) and `0` for the other two!
December 30, 2023 at 1:10 PM
#tinyCSStip Gradient hints work cross-browser!

Test
codepen.io/thebabydino/...
(without hint, with hint, difference)

What MDN says
developer.mozilla.org/en-US/docs/W...
January 9, 2024 at 10:16 AM
Know how border-image & border-radius don't play nice together?

(interactive codepen.io/thebabydino/...)

#tinyCSStip there's a workaround IF corner radius ≤ border-width: use inset() clip-path + a round value!

clip-path: inset(0 round $r)

@codepen.io demo: codepen.io/thebabydino/...

#CSS
March 17, 2025 at 8:10 AM
#tinyCSStip

❌ DON'T (blurry edge for big background-size, jagged edge for small background-size)
radial-gradient(at 0 100%, #000 69%, #0000 70%)

✅ DO (smooth edge regardless of background-size)
radial-gradient(at 0 100%, #000 calc(70% - 1px), #0000 70%)
August 15, 2024 at 10:54 AM