Пропустить навигацию
CSS Trick 🖼️ You could take the resize trick from last week and use it to create one of those…
0:00 / 0:30

CSS Trick 🖼️ You could take the resize trick from last week and use it to create one of those…

jhey ʕ•ᴥ•ʔ

@jh3yy149 тыс. подписчиков

Открыть в X
424 отметки «Нравится»СкачатьОригинальный пост

111 499 просмотров

CSS Trick 🖼️ You could take the resize trick from last week and use it to create one of those sliding image components 👀 CSS only, JavaScript to enhance later 🤓 Put an image in each panel and make them position: absolute. They can use a container query unit for their size 🫶 img { position: absolute; width: 100cqi; // Make them the container width 🤙 } .panel:last-of-type img { right: 0; } The rest of the trick from last week was using display:grid with grid-template-columns. Then we have a resizable element inside the first column 😎 .panels{ display: grid; grid-template-columns: auto 1fr; 👈 } .resizer{ max-width: 100cqi; overflow: hidden; resize: horizontal; 👈 } Where does JavaScript come in? To progressively enhance the thing with keyboard controls ✨ Not 100% sure of the pattern for that though. Feels like it should be a button that you can toggle into resize mode and then use left/right to resize 🤔 Anyways, CodePen.IO link below! 👇

8 комментариев

Комментарии из оригинального поста в X (Twitter)

  • Фото профиля jhey ▲🐻🎈

    @jh3yy

    Here's that @CodePen link! 🚀 To be honest, it's jus' messin' with the concept from last week for an article 😁 The design could totally be improved for sure 💯 Would love your input on that! 📢

    16 отметок «Нравится»

  • Фото профиля wés

    @wesleycoder

    It just came up in my mind that a <progress /> should fit in there somehow to help with the js enhancement. But the more I think about it the more it seems too convoluted. Maybe someone can improve the idea or just tell me how wrong I am.

    1 отметка «Нравится»

  • Фото профиля jhey ▲🐻🎈

    @jh3yy

    Ha 😅 It's a tricky one for sure. Same goes for the Drag and Drop API which is where my thinking takes me. To make that API a11y friendly, you can use space to toggle into the drag mode and then use arrow keys if I recall. The same could be done here with a tabbable button that's visually hidden 🤔

    2 отметки «Нравится»

  • Фото профиля JEM

    @Jacksonmills

    Wowowowowow saving this for later

  • Фото профиля Christo

    @chroxify

    sweet! 👏

  • Фото профиля Arpit Adlakha

    @arpit20adlakha

    Amazing 🤩

  • Фото профиля Arghya Das

    @itsarghyadas

    Should I try that in tailwindcss?🤔we will need custom CSS but I can try.

  • Фото профиля 高冷小姨

    @barton68453

    @rayc2045 The Garden awaits... The fight is comin'. Let's make your Banner cooler @rayc2045 🎯 Simple type: @MokugyoAI Banner Azuki ID Prompt Ex: @MokugyoAI Banner Azuki 1234 Shanghai Let's connect together!!! IKUZO ⛩️