Non-bouncy layouts

Dear Lazyweb, what's the done thing for making your text not bounce around in dynamic layouts?

I want my images to be dynamically sized to a percentage of the width of the window, not have hardcoded pixel sizes. And yet, I do not want this to force me into a 1994-style reflowing layout where the text moves around as the images load.

In other words, if the final layout looks like this:

All work and no play
img
makes Jack a dull boy

then before the image loads, I want it to look

like this:
All work and no play

makes Jack a dull boy
instead of like this:
All work and no play
makes Jack a dull boy

In the Bad Old Days, you fixed the bouncy-layout problem by specifying the image's width and height in pixels, but that doesn't work if you want the image to scale. In This Modern World, you have to specify "width:100%; height:auto" to accomplish that, and the "auto" means that the image shows up as zero-height until it has begun loading and its native size (and thus its aspect ratio) is known.

This sucks.

Basically I want some way to tell layout, "the intrinsic size of this image you're about to load is 1000px × 400px", or "the intrinsic aspect ratio of this image you're about to load is 10:4".

Is there any sane way to accomplish this? I guess it could be done in JavaScript, but I think you might end up needing to walk up the tree and basically duplicate the entire layout engine to make it work...

Previously.


Update:

Wow. Well, based on the comments here, and based on what I see out in the world, I think the answer is:

No. There's no sane way to fix it.

Every web site must choose between hardcoded image sizes; and having the text thrash around as the images load.

It's 1994 all over again.

Tags: , ,

The Dø

Tags: , , ,