On Sat, 23 Jun 2007, Trevor Nicholls wrote:

> my problem is what happens when the caption is
> much wider than the table rows.

We could try to address the problem by setting an explicit width for the 
caption, but in addition to being inconvenient (how could we know the 
right width?), it does not seem to work on IE.

There's the simple method of using

caption { white-space: nowrap; }

but it might be _too_ effective. The caption element might contain
explicit line breaks, <br>, though. (Simulating them in CSS is not 
a practical option.)

Optional line breaks - line break opportunities - could be coded in HTML 
as <wbr>, which is nonstandard but widely supported. There is no direct 
CSS counterpart. I thought that instead of

<caption>foo bar<wbr> some stuff</caption>
   with caption { white-space: nowrap; }

you could use

<caption><span class="part">foo bar</span> <span class="part">some 
stuff</span>
   with caption .part { white-space: nowrap; }

but this does not seem to work on IE 7 or Firefox 2. So I think you're 
back to using either <wbr> or <br> if you don't want the caption appear on 
one line, yet make it wider than the table proper.

> Or do I have to address this at the HTML level (ultimately this will be the
> XML level, where various elements map onto tabular equivalents)?

The white-space property should work well for XML documents as well.

You might also consider whether it is possible, in some cases, to avoid 
the problem by using shorter captions. After all, a table caption should 
be concise, heading-like; elements before or after the table, or maybe 
thead or tfoot elements, might be used to give additional explanations.

-- 
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/

______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to