Jason Crosse wrote:

> I've got a pretty basic question. How wide is a typographical space
> in relative units?

It's an interesting question, though not a CSS question as such. It may 
be relevant in CSS authoring, though, since you can turn a space into an 
element and then try to set its width. This would be somewhat tricky, 
though; instead, you would normally set padding or other properties for 
non-blank elements.

The width of the Ascii SPACE character varies by font. Moreover, when 
justification (text-align: justify) is applied, spaces may get stretched 
as needed.

Other space characters may have specific widths assigned to them, but 
they are generally more or useless in web authoring; see
http://www.cs.tut.fi/~jkorpela/chars/spaces.html

> I want to pad a one-line element's left side so
> it looks like a space has been inserted.

If I understand you correctly, you can just put a NO-BREAK SPACE 
(U+00A0) there, either as such (if you know how to type it - e.g., 
Alt+0160 works in most applications on Windows) or as the entity 
reference  . As a character, it is a clone of SPACE with the added 
feature that it is "non-breaking" when formatting text into lines. In 
practice, it has the same width as SPACE, though it is not stretchable 
in justification.

> Is there a reliable way of doing this (e.g 0.5ex;), or does is just
> depend on how big a given font's space is?

The ex unit is not really reliable for anything, because IE incorrectly 
implements it as half of em whereas e.g. Firefox correctly implements it 
as the x-height of the font, which is in practice always either smaller 
or larger than 0.5em. I have a web page about this, don't I... 
http://www.cs.tut.fi/~jkorpela/x-height.html

But you don't need the ex unit here, or CSS at all for this purpose, 
unless I misunderstood your question.

> If it's dependent on the font, is there a traditional proportion
> that's widely used across popular fonts?

Microsoft's typography page (which is not to be taken as an authority, 
just as a description of an important manufacturer's approach) says:

- The minimum value should be no less than 1/5 the em, which is 
equivalent to the value of a thin space in traditional typesetting.

- For an average width font a good value is ~1/4 the em.

- For a wide width font a good value is ~1/3 the em.

- The maximum width should be no greater than 1/2 the em, which is 
equivalent to the en space of a typeface.

http://www.microsoft.com/typography/developers/fdsspec/spaces.htm

So if you had a situation where you wanted, for some reason, to set e.g. 
the left padding of an element to match the width of a space, then
padding-left: 0.25em
would probably be the best guess in general.

Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/ 

______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to