- From: Tommy Hodgins via GitHub <sysbot+gh@w3.org>
- Date: Thu, 31 Aug 2017 17:37:37 +0000
- To: public-css-archive@w3.org
I don't understand why “expand to fit `scrollHeight`” hasn't been the _default_ behaviour for @<textarea>@ all along. In a lot of my demos where I want to add this sort of functionality I achieve this effect by somehow running the following 2 lines of JavaScript from the context of an element: ```javascript element.style.height = 'inherit' element.style.height = element.scrollHeight + 'px' ``` I've written a little JavaScript function that can help me apply an auto-height or auto-width to elements that match CSS selectors here that uses this same logic: https://github.com/tomhodgins/reprocss#auto-expand-mixin Mixin Demo: https://tomhodgins.github.io/reprocss/test/auto-expand-mixin.html Another Auto-Height demo: https://codepen.io/tomhodgins/pen/KgazaE?q=expand&limit=mine&order=popularity&depth=everything&show_forks=false Another Auto-Width demo: https://codepen.io/tomhodgins/pen/ZpLxjy?q=expand&limit=mine&order=popularity&depth=everything&show_forks=false As for auto-height `<iframe>`, I believe I've seen this happen on iOS before, but I'm not sure I could dig up the CSS. I'll see if I can recreate it :D -- GitHub Notification of comment by tomhodgins Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1771#issuecomment-326368829 using your GitHub account
Received on Thursday, 31 August 2017 17:37:39 UTC