跳过导航
Future CSS Tip! 🚀 You can create auto-resizing text inputs with one line of CSS 🔥 textarea, input {…
0:00 / 1:31

Future CSS Tip! 🚀 You can create auto-resizing text inputs with one line of CSS 🔥 textarea, input {…

jhey ʕ•ᴥ•ʔ

@jh3yy15万 位关注者

在 X 上查看
1,918 个赞下载原帖

319,378 次观看

Future CSS Tip! 🚀 You can create auto-resizing text inputs with one line of CSS 🔥 textarea, input { field-sizing: content; } No more JavaScript to sync a textarea height to fit the content 🫶 Perfect for chat, messaging, comments, etc. 💬 The size of your input will grow to fit your content. If you want to constrain the size, do something like this: textarea { field-sizing: content; min-height: 2lh; /* Use the line-height unit 😎*/ max-height: 10lh; } Love the fact you could use this for auto-resizing in both directions too! 🙌 Want a search field that expands horizontally? Do it! Love these one-liners that bring incredible value to the platform like this 💙 CodePen.IO link below! 👇

20 条评论

评论来自 X (Twitter) 上的原帖

  • jhey ▲🐻🎈 的头像

    @jh3yy

    Here's that @CodePen link! 🚀 Only available in Chrome Canary at the moment 🥲 Fallback would be that your inputs don't resize unless you tap into it with some JavaScript ✨

    36 个赞

  • PDF GPT 的头像

    @pdfgptsupport

    Everyone is getting ahead with AI. You should be too. Summarize documents, craft emails, and generate custom content instantly with this powerful tool. It's like having ChatGPT tailored for your job. Try it for free.

    12,366 个赞

  • Kartuzinski 的头像

    @kartuzinski

    Nice. I also saw @wesbos tweeting about this. This is quite a big deal!

    5 个赞

  • jhey ▲🐻🎈 的头像

    @jh3yy

    @wesbos Yeah, such a great addition! 🫶 It went through a little renaming recently, was going to be slightly different a couple of months ago. Like the new name 💯

    2 个赞

  • Anthony Riera 的头像

    @_anthonyriera

    No freaking way, I've been struggling so much with that 😂 You saved us sir

    3 个赞

  • App Beast 的头像

    @AppBeast

    Really nice once it actually is available in many browsers.

    2 个赞

  • jhey ▲🐻🎈 的头像

    @jh3yy

    Yeah, fortunately, we have "supports" so we can get things in place as a nice Easter egg for those using supported browsers. Kinda nice too as it makes you think a bit more about design as you implement things I've found ✨

    2 个赞

  • Floris 的头像

    @FirstFloris

    What would be the fallback for non-supported browsers?

    1 个赞

  • Vitor Markis 的头像

    @vitormarkisdev

    ho do you add this smooth cursor effect on your vids? I'm so obsessed with it

    1 个赞

  • Veer Singh 的头像

    @VeerSin74520658

    what software do you use to edit your tutorials like this ?

    1 个赞

  • Helloyunho 的头像

    @helloyunho_life

    @discord time to use the css instead of js lol

    1 个赞

  • coirElephant 的头像

    @satish_313

    I usually used javascript scrollheight method to achieve it.

  • Uday Mungalpara 的头像

    @udaymungalpara

    Amazing 👏👏

  • marissa27r 的头像

    @MAReinke

    🤯❤️

  • MikeeBuilds ⛩️〰️🧱 的头像

    @MikeeBuilds

    Saw this on LinkedIn today. Good that this tip is spreading and making the rounds. Makes it much easier 💯👏🏾

  • Sourov Basu 的头像

    @learn_react_07

    Cool tip

  • Mohan kumar 的头像

    @kumar_mks23

    Does this support every browser?

  • TForrest 的头像

    @TFD_UX_UI

    How did you do the glow effect on the border? It was so clean 🥶

  • Frank Stallone 🧘🏻‍♂️ 的头像

    @frankstallone

    What do you use to record these screens? Super slick with the zooming in and out effects. As always that’s for sharing and ask the help! 👏🏻🙏🏻🙌🏼

  • Juan Cruz 的头像

    @JuanCLamb

    Awesome, that’s great!