W3C home > Mailing lists > Public > w3c-wai-ig@w3.org > April to June 2002

RE: CSS sizing

From: Jukka Korpela <jukka.korpela@tieke.fi>
Date: Thu, 4 Apr 2002 09:13:49 +0300
Message-ID: <621574AE86FAD3118D1D0000E22138A95BDC4D@TIEKE1>
To: "WAI (E-mail)" <w3c-wai-ig@w3.org>
SHARPE, Ian wrote:

> Does CSS provide a mechanism for sizing buttons based on 
> their content?

You mean suggesting the width or height of an <input> or <button> element as
relative to its content in some way? Well, yes, for example
<input type="submit" value="Send" style="height:2em">
makes the height depend on the font size of the the text. (Technically, on
the font size of the enclosing element, but the button text size normally
depends on that.)

But if you meant making the dimensions depend on the actual dimensions of
the content of a <button> element, it seems that the answer is "no". I can't
find anything in CSS1 or CSS2 for that (but I might miss something - CSS2 is
rather complex).

What is the accessibility issue involved? If you're interested in CSS
generally, with no particular WAI connection, I'd suggest raising the
questions in news:comp.infosystems.www.authoring.stylesheets (which is a
nice group with many experts and good FAQ resources). 

> Similar to using line-height: 105% which ensures text on 
> adjacent lines doesn't overlap.

Sorry, I can't see a connection to the above. And typically browsers have
apply line-height greater than 1 _by default_. In fact, the sample style
sheet for HTML 4.0 in the CSS2 specification,
http://www.w3.org/TR/REC-CSS2/sample.html
which is claimed to describe "typical formatting" (as per browser defaults)
and also presented as some kind of a recommendation, has
BODY            { padding: 8px; line-height: 1.33 }

As regards to accessibility, I think it is normally best that authors do not
set line-height in their style sheets. The defaults are probably OK for most
users, and those who need larger spacing between lines should really make
their _user_ style sheets set line-height to a sufficiently large value.

Actually, some users with eyesight problems may need to _reduce_
line-height, in addition to reducing font size, in order to make more text
fit into the area that they can see sharp. It is less common than the need
for bigger spacing or larger fonts, but worth mentioning here. There's a
misconception that authors should use large font size (and perhaps large
line spacing) for accessibility reasons.

-- 
Jukka Korpela
TIEKE Tietoyhteiskunnan kehittämiskeskus ry
Finnish Information Society Development Centre 
Salomonkatu 17 A, 10th floor, FIN - 00100 HELSINKI, FINLAND
Phone: +358 9 4763 0397 Fax: +358 9 4763 0399 
http://www.tieke.fi  jukka.korpela@tieke.fi
Received on Thursday, 4 April 2002 01:11:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 19 July 2011 18:14:04 GMT