Загрузка видео...

Не удалось загрузить видео

На главную

CSS Tip! 🤙 Use custom properties to work out the nested radius of elements for you 😎 .parent { --nested-radius: calc(var(--radius) - var(--padding)); } .nested { border-radius: var(--nested-radius); } Couldn't resist making an interactive visual! CodePen.IO link below 👇

795,379 просмотров • 2 лет назад •via X (Twitter)

Комментарии: 10

Фото профиля jhey ▲🐻🎈
jhey ▲🐻🎈2 лет назад

Here's that @CodePen link! 🚀

Фото профиля Aykut
Aykut2 лет назад

@CodePen I have an interactive article where I explain the logic here. ✨ 👉🏻

Фото профиля jhey ▲🐻🎈
jhey ▲🐻🎈2 лет назад

No SoundCloud 😞 But. If you're a developer who wants to pick up some more design skills, my "soon-to-be wife"(👀) has written a book and it's 45% off 👇 Grab a copy! 🔥

Фото профиля Jacob Miller
Jacob Miller2 лет назад

@CodePen From a design standpoint this is a great best practice. From an implementation standpoint, I typically don't like to have dynamic css for static code. Assuming the border radius base value and the padding never change, I'd move this into the preprocessor rather than use a calc

Фото профиля Gal Shir
Gal Shir2 лет назад

@CodePen Smart!

Фото профиля José Breijo
José Breijo2 лет назад

@CodePen Giving control to the user is fundamental to enhancing the experience to their likeness, great work on building some tooling 🙏👌. Btw I'm curious about your opinion of I made the tooling there with Preact signals 👀.

Фото профиля Eduardo Mexia
Eduardo Mexia2 лет назад

@CodePen @iCota4G

Фото профиля Khoa • CRO | Landing pages
Khoa • CRO | Landing pages2 лет назад

@KevinJPowell @CodePen So useful! thanks for sharing! =)

Фото профиля Soggy Bread
Soggy Bread2 лет назад

@CodePen 🙏 Bless you I’m putting this into practice today as a reusable scss mixin

Фото профиля Anas Bashir
Anas Bashir2 лет назад

@CodePen I am right now building a tic tac toe game, and put border radius for a parent and child, and it looked weird, and then I remembered this and searched it up and thank god I found it. Thank you so much!!

Похожие видео