On Thursday, March 03, 2005 8:20 AM [GMT+0100=CET],Peter-Paul Koch
>> I am trying to create a two-column layout in HTML generated via JSP.
>> The left column is an image, and the right is text describing the
>> image. This seems pretty straightforward, except for one catch - I
>> don't know the width of the image, and all of the 2-column layouts
>> I've seen require some knowledge of at least one column's width.
>> Technically, I *do* know the width and could use JSP to insert the
>> value into the properties, with an embedded stylesheet:
>> width: <%= imageWidth%>;
> Use a table. The left column will stretch up as much as necessary, and
> the right one will shrink appropriately.
That's what I'm doing now. I've been reading a lot on tables good vs table
bad, and haven't reached a conclusion yet. Practical considerations may win
out over theory in this case.
> If you don't want to use tables you've got a problem. You have to
> define the widths of both columns somewhere, or the float-based
> positioning won't work.
That's what I thought. Rats.
> If it were my site I'd go for the JSP-generated CSS bit in the HTML
> page. True, it's not perfect separation of structure and presentation,
> but in your case every individual page needs special instructions
> anyway, since all the image are (could be) of different sizes.
That's probably what I'll do. This column set is part of a larger layout.
I've been thinking that I'd like the larger layout to be completely flexible
(a la CSS Garden). My original plan was that the image would be one
component, and the text would be another, and that my initial presentation
would be putting those in a two-column set. However, if I treat the two of
them together as one component that always shows as a two-column (wherever
it is in the larger layout), I can safely use my JSP trick.
> As far as I can see this problem is unsolvable with just one general
> style sheet, unless you're willing to stretch all left columns to the
> width of the widest image.
That's another possibility, but I'm not thrilled with it. The layout is for
a community theater site, and the images are "production logos". I have no
control over their sizes. I do try to make all production logos for a given
season the same width, but even that fails sometimes when there's a logo
that's much wider or narrower than the others.
> (Of course I may be wrong; in that case please tell me how you'd do
I'd ask CSS-Discuss :-)
"Males ae biologically driven to go out and hunt giraffes." - Newt Gingrich
"Some folks you don't have to satirize, you just quote 'em." - Tom Paxton
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/