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

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

На главную

CSS Tip 📖 Use CSS shape-outside to wrap text around shapes .column--left .shape { float: right; shape-outside: circle(100px at 100% 50%)); }

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

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

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

Here's the @CodePen link! 🤙 The trick is to use 2 columns with two elements for shape-outside, a semi-circle for each column 📖 Then you can power it with custom properties as seen in the video above 😎

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

The only "caveat"? 👀 You're limited in how you use it. You need to split your content into columns manually 🙃 It doesn't play nice with column-count Not the end of the world though and would look nice on some landing pages etc. 🤙

Фото профиля Simon Vrachliotis
Simon Vrachliotis2 лет назад

Now make the DVD screen saver bouncing thing and the text wraps around it to let it pass

Фото профиля Dheeraj Purohit धीरज पुरोहित ⭕❗⭕
Dheeraj Purohit धीरज पुरोहित ⭕❗⭕2 лет назад

Woah 😲✨ Is it all static elements(2 cols and circle) , I mean by position

Фото профиля 𝑨𝒏𝒂𝒕𝒉𝒆𝒎𝒂
𝑨𝒏𝒂𝒕𝒉𝒆𝒎𝒂2 лет назад

Bro nailed it

Фото профиля Airem
Airem2 лет назад

Shape-outside ? CSS is insane. What's left to add ?

Фото профиля Baiee
Baiee2 лет назад

service 🔥

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

Should change my bio 😅 "Demos as a service" "Tag me and demos will follow"

Фото профиля 𝐑𝐮𝐬𝐬 🖤
𝐑𝐮𝐬𝐬 🖤2 лет назад

I wonder if it works with images, I could see some cool stuff being created with this.

Фото профиля Luke Martin
Luke Martin2 лет назад

Seeing float

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

CSS Tip! 💪 You can create these tab controls with CSS :has() + radio buttons ✨ .tabs:has(input:nth-of-type(3)) { --count: 3; } .tabs:has(:checked:nth-of-type(3)) { --active: 2; } .tabs::after { translate: calc(var(--active, 0) * 100%) 0; width: calc(100% / var(--count)); } Two CSS :has() tricks here combined with a rendering trick 🤙 The tab control is a container using display: grid. You can use :has() to count the number of tabs in the container: .tabs:has(input:nth-of-type(3)) { --count: 3; } .tabs:has(input:nth-of-type(4)) { --count: 4; } Using the cascade, the last valid :has() gives you the number of tabs 🫶 Once you know the number of tabs, you know how to size the indicator: .tabs::after { content: ""; position: absolute; height: 100%; width: calc(100% / var(--count)); } It's a pseudoelement that uses --count to determine its size 📏 The next :has() trick is determining which tab is active or :checked as it's an input [type=radio] .tabs:has(:checked:nth-of-type(2)) { --active: 1; } .tabs:has(:checked:nth-of-type(3)) { --active: 2; } You can use a zero-indexed translation here. If the second input is :checked, set --active: 1, then translate the pseudoelement on the tabs to that position 👉 .tabs::after { translate: calc(var(--active, 0) * 100%) 0; } The last rendering trick is using mix-blend-mode 👀 The tabs have a black background-color, the pseudoelement is white, and the label text is white. When you use mix-blend-mode: difference on the pseudoelement it will give this effect that the text transitions from white to black sliding across 😎 .tabs::after { color: hsl(0 0% 100%); mix-blend-mode: difference; } You can totally mix up the colors here though and go with a different effect. The mechanics of how you can use CSS :has() is the main point here 🙏 As always, any questions, suggestions, etc. let me know CodePen.IO link below! 👇 (There's even a Tailwind CSS play for this one too 👀)

jhey ʕ•ᴥ•ʔ

437,714 просмотров • 2 лет назад