Skip navigation
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 ʕ•ᴥ•ʔ

@jh3yy148K followers

Visit on X
1,918 likesDownloadOriginal post

319,378 views

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 Comments

Comments from the original post on X (Twitter)

  • jhey ▲🐻🎈's profile picture

    @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 likes

  • PDF GPT's profile picture

    @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 likes

  • Kartuzinski's profile picture

    @kartuzinski

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

    5 likes

  • jhey ▲🐻🎈's profile picture

    @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 likes

  • Anthony Riera's profile picture

    @_anthonyriera

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

    3 likes

  • App Beast's profile picture

    @AppBeast

    Really nice once it actually is available in many browsers.

    2 likes

  • jhey ▲🐻🎈's profile picture

    @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 likes

  • Floris's profile picture

    @FirstFloris

    What would be the fallback for non-supported browsers?

    1 like

  • Vitor Markis's profile picture

    @vitormarkisdev

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

    1 like

  • Veer Singh's profile picture

    @VeerSin74520658

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

    1 like

  • Helloyunho's profile picture

    @helloyunho_life

    @discord time to use the css instead of js lol

    1 like

  • coirElephant's profile picture

    @satish_313

    I usually used javascript scrollheight method to achieve it.

  • Uday Mungalpara's profile picture

    @udaymungalpara

    Amazing 👏👏

  • marissa27r's profile picture

    @MAReinke

    🤯❤️

  • MikeeBuilds ⛩️〰️🧱's profile picture

    @MikeeBuilds

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

  • Sourov Basu's profile picture

    @learn_react_07

    Cool tip

  • Mohan kumar's profile picture

    @kumar_mks23

    Does this support every browser?

  • TForrest's profile picture

    @TFD_UX_UI

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

  • Frank Stallone 🧘🏻‍♂️'s profile picture

    @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's profile picture

    @JuanCLamb

    Awesome, that’s great!