W3C home > Mailing lists > Public > www-style@w3.org > December 1999

CSS character width unit missing: an oversight, methinks?

From: Nils Klarlund <klarlund@research.att.com>
Date: Fri, 3 Dec 1999 09:04:24 -0500 (EST)
Message-ID: <yqz2wvqwgly4.fsf@fish-ha.research.att.com>
To: www-style@w3.org

I have taken CSS quite seriously as a formatting model for typesetting
or pretty-printing programming notations*.

I need a way of indenting a div-box an amount of space that is a
multiple of the character-width (I'm using a bold, fixed-with font).

Unfortunately, this is not possible since there is no way of referring
to the width of a character in CSS (em and ex don't give me the
width). A fundamental, little, or inconsequential oversight in CSS?

(I fake it by using ex and a multiplier in my XSLT; a certain value
gives near-optimal results in IE5, Netscape 4, and Mozilla.)

More generally, I would like a mechanism that allows me to use the
width of a box X as a width parameter of box Y.  Setting box X with
visibility:hidden doesn't give me a method of extracting its width.
(As far as I can tell.)

/Nils

*) See http://www.brics.dk/DSD/dsd2html.html for a very long XSLT
description of how to produce nice-looking HTML from abstract syntax
trees.
Received on Friday, 3 December 1999 12:03:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:01 GMT