W3C home > Mailing lists > Public > public-css-archive@w3.org > August 2017

[csswg-drafts] [css-sizing] Auto-resize iframes and textarea based on content

From: Tab Atkins Jr. via GitHub <sysbot+gh@w3.org>
Date: Thu, 31 Aug 2017 17:29:23 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-254410850-1504200556-sysbot+gh@w3.org>
tabatkins has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-sizing] Auto-resize iframes and textarea based on content ==
**In <https://lists.w3.org/Archives/Public/www-style/2017Aug/0045.html>, Craig Francis said:**

Just re-raising the suggestion of allowing an iframe or textarea to increase its height based on its content.

Mats Palmgren suggested that I raise this issue again, as Firefox is unlikely to implement it unless the CSSWG agrees to spec it.

For iframes, this feature would allow easy and secure (isolated) embedding of third party content without issues relating to scroll bars (i.e. needing custom JavaScript to ask the parent page, via postMessage, to change the iframe height).

For textrareas, this is just a convenience feature, as trying to get JavaScript to do this is tricky (e.g. the browser can automatically add/remove scroll bars, which can throw off the calculations).

When we discussed this last time (after the @seamless attribute on the <iframe> was removed from the WHATWG spec), it was suggested that we used:

textrarea {
    height: max-content;

In the case of the iframe, the child page would need to send a HTTP header (e.g. Expose-Height-Cross-Origin: 1), so it does not leak information about that website (e.g. if the user is logged in).

PS: This has been discussed in a number of times before, the earliest one I've found is 16 years old:


And I've written up some notes about this feature, which includes the suggestion of using it for element height animation (e.g. disclosure widgets):


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1771 using your GitHub account
Received on Thursday, 31 August 2017 17:29:20 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:17 UTC