[whatwg] Iframe dimensions
Markus Ernst
derernst at gmx.ch
Mon Jul 5 10:13:22 PDT 2010
Hello
I found that the dimensions of the iframe element are handled along with
those of other embedded content such as img, video and others:
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-map-element.html#attr-dim-width
There is no indication about what a UA should do when dimension
attributes are not specified. UAs do seem to handle this case
differently for those elements: To an img element, they apply the actual
pixel dimensions of the image file, while they seem to apply default
dimensions to iframe elements.
But there are some special indications in the part about the @seamless
attribute:
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-iframe-element.html#attr-iframe-seamless
<quote>
o In visual media, in a CSS-supporting user agent: the user agent should
set the intrinsic width of the iframe to the width that the element
would have if it was a non-replaced block-level element with 'width: auto'.
o In visual media, in a CSS-supporting user agent: the user agent should
set the intrinsic height of the iframe to the height of the bounding box
around the content rendered in the iframe at its current width (as given
in the previous bullet point), as it would be if the scrolling position
was such that the top of the viewport for the content rendered in the
iframe was aligned with the origin of that content's canvas.
</quote>
First, this sounds somehow complicated to me, and second, I don't
understand why the dimensions of non-seamless iframes should not get the
benefits of author-friendly (and user-friendly) dimension handling.
I want to suggest to provide a way to make an iframe behave just like
any block element regarding width and height, that means: If no
dimensions are specified, use the full available width, and apply the
height needed to display the full content.
Use case:
Some content from an external specialized content provider is included
in an existing web site via an iframe. This cannot be seamless, as the
links in the iframe must point to the original domain of the included
document. But in order to avoid double scroll bars, it would be
desirable to have the height of the iframe adjusted to it's content.
Example:
http://test.rapid.ch/de/haendler-schweiz/iseki.html
(This is under construction.) As a workaround to the height problem, I
applied a script that adjusts the iframe height to the available height
in the browser window. But of course the user experience would be more
consistent if the page could behave like a single page, with only one
scrollbar at the right of the browser window.
Possible solutions:
- Invent an attribute that makes the iframe element behave like any
block element (independent from @seamless)
- Respect the CSS display property; display:block would then make an
iframe rendered like a block element
While I personally would be happy with the second solution, I have no
idea if this can be specced in HTML5, as it is CSS. And AFAICS the CSS
specs do not cover individual HTML elements.
I'd be happy about some comments!
More information about the whatwg
mailing list