Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

Must be time for the Q4 nested radius post 📅 Remember, the CSS tip is that you can use custom properties to work out the nested radius of elements for you 😎 .panel { --radius: 28px; --padding: 8px; --nested-radius: calc(var(--radius) - var(--padding); } .content { border-radius: var(--nested-radius); } Here's...

532,905 Aufrufe • vor 2 Jahren •via X (Twitter)

10 Kommentare

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

Here's that @CodePen link! 🚀

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

Bunch of people have been quoting my Q3 post on this in response to some of those satirical posts 😅 Figured I might as well roll it back out again 🤙

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

If you have a border present, it's good to account for that too 💯 .panel { --nested-radius: calc( (var(--radius) - var(--padding)) - var(--border) /* Account for the border 🤙 */ ); }

Profilbild von Adam Argyle
Adam Argylevor 2 Jahren

also! overflow-clip-margin: content-box; no math, which can be nice

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

This was gonna be the follow-up 🤫😅 Purely revisiting the radius - padding trend 😅

Profilbild von Danny Clayden Chambers
Danny Clayden Chambersvor 2 Jahren

This post is cutting edge 😄

Profilbild von jhey ▲🐻🎈
jhey ▲🐻🎈vor 2 Jahren

Haha – I was almost fearful of a bug in Edge being raised there 😅

Profilbild von Dan ⚡️
Dan ⚡️vor 2 Jahren

I find this oddly satisfying. should pick up border radius as a hobby 😃

Profilbild von siriwatknp
siriwatknpvor 2 Jahren

Thanks for the tips @jh3yy. I found an edge case where `padding` > `radius` and got it covered with: --nested-radius: max((var(--radius) - var(--padding), min(var(--padding) / 2, (var(--radius))); I use this trick all over the place for @Joy_UI_

Profilbild von Juri · juri.dev
Juri · juri.devvor 2 Jahren

I just saw someone ask for exactly this the other day here

Ähnliche Videos