WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Wrapping <legend>?

for

From: Jukka K. Korpela
Date: Jan 14, 2005 5:13PM


On Fri, 14 Jan 2005, c.brys wrote:

> A problem I have only noticed recently and which I am still struggling with
> is that in IE (PC) and Mozilla, legend do not wrap by default. Labels do but
> legends don't.

This is a very strange phenomenon, which I hadn't observed earlier either.
It's a general rendering problem, rather than basically accessibility,
though in accessibility we are especially interested in things like
viewability in a narrow window.

It seems that browsers behave as if legend elements had by default
white-space: nowrap assigned to them. What's worse, the obvious attempt
legend { white-space: normal; } does not help, as you surely noticed.
Explicit breaks with are honored, but we don't really want to use
them, do we?

> I have found a work-around for IE users by putting a span with <span
> style="width: 100%;word-wrap:break-word">

Quite astonishing. It's a risky workaround though. The IE-only setting
word-wrap: break-word actually means that IE may break a word at any
point, without even indicating (with a hyphen) that a word has been
broken, e.g.
Conf
erence
though IE seems to _prefer_ breaking at word boundaries.

What I would suggest is using very short legend texts, so that wrapping
will almost never be needed. Just a few words. If longer explanations are
needed, you can put them after the legend element.

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