#Blending

Ana Tudor 🐯anatudor
2025-05-13

Because this @codepen demo just got hearted and I've never shared it here before codepen.io/thebabydino/pen/Vwm

The concept behind the XOR is something I explained in this
@csstricks article css-tricks.com/taming-blend-mo

(should probably redo it with view transitions)

2025-04-17

For Hugo there was '#blending in' and there was *blending in*.
This was too much.
Every week back home would ring an old phone line in Forrest's basement at 8:56 p.m. local time. He had to pick up on the eighth ring to actually make contact.
No more.
No fewer.
Two students ran past. Newspaper between their heads and the rain. Hugo stood back in the shadows and checked his watch.
8:43 p.m.
When the coast was clear, he bolted for the maintenance entrance. 2/x
#wss366

Having a go on the wheel . wedged in some wild red ochre slip into white clay first . loving the magic #pottery #wheelturned #ochre #ceramics #blending #clay #wild

Ana Tudor 🐯anatudor
2025-04-12

You can find a very detailed explanation about the how behind in my Taming Blend Modes: `difference` and `exclusion` article on @csstricks css-tricks.com/taming-blend-mo

Screenshot of an interactive demo, highlighting how the `difference` blend mode works.
Ana Tudor 🐯anatudor
2025-04-12

And here are cards with gradual left to right inversion: from no inversion at all on the left, to full inversion on the right. Again, minimal code, single div, no pseudos necessary, 2 declarations.

Live demos on @codepen

✳️ codepen.io/thebabydino/pen/mdO

✳️ codepen.io/thebabydino/pen/dyO

.card {
  background:
		url(image.jpg) 50%/ cover, 
		linear-gradient(90deg, #000, #fff);
  /* or the difference blend mode */
	background-blend-mode: exclusion
}Original image: blue butterfly.Inverted image using the exclusion blend mode. The butterfly goes from its original blue on the left to red on the right, passing through a 50% grey.Pseudo-inversion of image using the difference blend mode. The butterfly goes from its original blue on the left to red on the right, this time passing through other hues rather than through a 50% grey.
Ana Tudor 🐯anatudor
2025-04-11

Here's another set of cards with varying patterns, all created with the exact same 4 blended CSS gradients, it's just the stops list `--c` that changes for each card.

So basically, it's again just one `background` + one `background-blend-mode` property.

Live demo on @codepen
codepen.io/thebabydino/pen/vYy

.card {
	--s: rgb(0 0 0/ .2) 0, #0000 5px 50px;
	background: 
		/* shadows */
		repeating-linear-gradient(45deg, var(--s)), 
		repeating-linear-gradient(-45deg, var(--s)), 
		/* main pattern */
		repeating-linear-gradient(45deg, var(--c)), 
		repeating-linear-gradient(-45deg, var(--c));
	background-blend-mode: 
		multiply, multiply, lighten
}

.card:nth-child(1) {
	--c: #847971 0 10px, #938981 0 20px, 
		#9e938a 0 30px, #a89c93 0 40px, #bfb6ab 0 50px
}

.card:nth-child(2) {
	--c: #333 0 10px, #555 0 20px, 
		#c55 0 30px, #ccc 0 40px, #eee 0 50px
}Up arrow card patterns.More up arrow card patterns.
Ana Tudor 🐯anatudor
2025-04-11

And here's a cards demo with a cool, yet very simple trick: these left to right gradients are vibrant at the top, but then progressively get more and more desaturated going down, until fully grey.

Live on @codepen codepen.io/thebabydino/pen/xxz - only 2 CSS declarations necessary!

Screenshot of demo with gradient cards, all showing left to right gradients, vibrant at the top of the card, but getting progressively more and more desaturated as we go towards the bottom..card {
  /* relevant code for the effect */
	background: 
		linear-gradient(90deg, 
        var(--stop-list)), 
		linear-gradient(#0000, grey);
	background-blend-mode: luminosity;

  /* other styles */
	aspect-ratio: 3/ 2;
	border-radius: .5em;
	box-shadow: 2px 2px 5px 1px #040404
}
Ana Tudor 🐯anatudor
2025-04-09

By the way, the code is heavily commented codepen.io/thebabydino/pen/MYW

So you can see how it works without JS, without wrapping individual elements into spans, just letting it wrap naturally. And without covers that wouldn't allow for an image backdrop behind the text.

Testing blending some clays . biggest lump I've been able to wedge since surgery . stoked . Core strength returning . Can I make a pinch pot from this? Or will it mess up the marbling? I'd like a coffee mug #pottery #handbuilding #blending #marbling

Ana Tudor 🐯anatudor
2025-03-19

If we have an inline `span` inside a `p` & we give it a semi-transparent `background` + a `padding`, we get an alpha increase where backgrounds of adjacent lines overlap.

How would you solve this problem without text duplication, without stacking 2 identical `p` elements, one for background (opaque background + transparent text + opacity) and one for text (transparent background)?

The visual result showing four lines of text, middle aligned, each with its own semitransparent background and padding. The padding on each line leads to intersection, and where we have intersection, the semi-transparent background becomes more opaque.

The CSS producing this is:
```
p > span {
  padding: .25em;
  border-radius: 5px;
  background: rgb(0 0 0/ var(--a, .7));
  color: #fff;
  /* add lateral padding + border-radius to each line */
  box-decoration-break: clone
}
```
Ana Tudor 🐯anatudor
2025-03-18

Hi, mastodon 🦣 I have a new article out!

A Deep Dive into the Inline Background Overlap Problem: frontendmasters.com/blog/overl

How do you get the below result (semi-transparent background on inline span) with large padding & no overlap?

Answer in article, but think a bit about it first. 😼

βœ… Desired result: consecutive line backgrounds overlap doesn't result in alpha increase and the text is always on top of the background, including that of adjacent lines.❌ Problem: by default, consecutive span lines with semi-transparent backgrounds have an increase in alpha at the overlap and the text on all but the last line is partly covered by the background of the next.
Ana Tudor 🐯anatudor
2025-03-04

Oh, Firefox, why are you doing this? 😭 πŸͺ²

bugzilla.mozilla.org/show_bug.

2025-02-01
Plan for #ColumnShaft of #IonicColumn

The #shaft of an #Ionic column is not perfectly cylindrical but gradually tapers off in the top 2/3 of the shaft. As such, the #primaryProfileCurve is not a straight line, nor is it composed of regular arcs. Instead, it is a complex amalgam of straight lines, circular arcs, and #NURBS curves, where the fancy acronym stands for an even fancier name β€” "Non-Uniform Rational B-Splines."

So, the promise [https://pixelfed.social/p/Splines/789956327130679640] was that we were going to get through this by drawing just straight lines and arcs. How are we going to draw NURBS? The answer is that we won't. The #CAD program will, as long as we give it sufficient information to carry out the task.

There are three NURBS curves in the profile shown in the plan. The longest and the most important one is between the points marked C through J. There is a smaller one between B and C, and an even smaller one between J and K.

While all three NURBS curves are mathematically similar, the information we must provide to the CAD program for the longest one is different from the other two short ones, and the operations the CAD program carries out to construct the longest one and the other two curves is also different.

This brings us to two new operations β€” #interpolate or "fit through points," and #blend shapes (existing curves or surfaces). When you choose a CAD program, make sure it supports NURBS, #interpolation, and #blending.

Starting at the bottom of the shaft, point A is 144 units from the #columnAxis, and so is point B, which is also 768 units higher than A. Starting with C through J, the points gradually move closer to the axis until J is exactly Β΅ * 5/6, or 120 units from the axis. These points are equidistant vertically β€” all 192 units apart. However the horizontal distance is non-uniform.

In the next post we will mark the 8 points C through J using using one arc and 8 straight lines β€” I will keep my promise.
Ana Tudor 🐯anatudor
2025-01-07

Pure 1 div halftone-masked background card codepen.io/thebabydino/pen/GRN on @codepen.

Made this 4 years ago - can you guess how before checking the code?

Doesn't work in Firefox due to an old bug πŸͺ² bugzilla.mozilla.org/show_bug. not even related to the halftone mask, but caused by the duo text on the right.

card with halftone mask on image on the left and duo text on the right (two lines of text, top one white, bottom one reddish)
2025-01-03

Tea lovers, assemble! Blending your own brews at home? A game changer! Be consistent, get creative, and connect with cultures. Why settle for ordinary when you can craft extraordinary?

Read more here: jyyna.co.uk/tea-blending-and-a

Ana Tudor 🐯anatudor
2024-12-06

By the way, this is my second article for Frontend Masters.

My first was a few months ago and it was about creating dynamic split effects (image, text, page) without any content duplication whatsoever frontendmasters.com/blog/split

Ana Tudor 🐯anatudor
2024-12-04

I have a new article out: πŸŽ‡ Pure CSS Halftone Effect in Only 3 Declarations πŸŽ‡ frontendmasters.com/blog/pure-

This goes through the how behind the 3 declarations and then explores a lot of variations that help us produce 🌟 cooler, more interesting 🌟 patterns.

Client Info

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