J
Jukka K. Korpela
Scripsit John Hosking:
It's still not evident what the problem is. As usual, a URL would
have...
Not to me, really. A few clarifications:
1) There is no "m-width" and "n-width" space. The width of an EM SPACE
equals the font size, by definition, and the width of an EN SPACE is
half of that. Their relationship to the widths of the letters "m" and
"n" is unspecified.
2) Normal spaces do collapse. This can be prevented in different ways,
but not in any evident way in inline text. (white-space: pre-wrap in CSS
would do this, but regarding browser support, "D'Oh!")
3) Whether em spaces, en spaces, or no-break spaces collapse is
explicitly declared unspecified in HTML specifications. In practice they
don't, but if IE 8 or Firefox 4 starts collapsing them, you can only
blame yourself if you relied on their not being collapsed.
4) The no-break space should prevent line breaks before and after. There
are some flaws in this area in browsers when a no-break space is
preceded or followed by a normal space.
But why would it be a _problem_ that line breaks are prevented, if you
want a specific placement of characters? To me, it seems like a
necessary part of a _solution_.
Since this was said to be computer output, markup like
<pre><samp>abcde
a e</samp></pre>
would appear to be adequate. If this won't do, the OP should explain why
not.
By the specifications, "a e" should have one break possibility
only, after the second space. Some browsers get this wrong. But I don't
see a reason for using such an approach.
As I mentioned above, no-break spaces may or may participate in the
collapse party. Currently they don't, but you have been warned:
"This specification does not indicate the behavior, rendering or
otherwise, of space characters other than those explicitly identified
here as white space characters [i.e. space, tab, form feed, zero-width
space]. For this reason, authors should use appropriate elements and
styles to achieve visual formatting effects that involve white space,
rather than space characters."
http://www.w3.org/TR/REC-html40/struct/text.html#h-9.1
(e-mail address removed) wrote: - -
Much clearer.
It's still not evident what the problem is. As usual, a URL would
have...
Even clearer.
Not to me, really. A few clarifications:
1) There is no "m-width" and "n-width" space. The width of an EM SPACE
equals the font size, by definition, and the width of an EN SPACE is
half of that. Their relationship to the widths of the letters "m" and
"n" is unspecified.
2) Normal spaces do collapse. This can be prevented in different ways,
but not in any evident way in inline text. (white-space: pre-wrap in CSS
would do this, but regarding browser support, "D'Oh!")
3) Whether em spaces, en spaces, or no-break spaces collapse is
explicitly declared unspecified in HTML specifications. In practice they
don't, but if IE 8 or Firefox 4 starts collapsing them, you can only
blame yourself if you relied on their not being collapsed.
4) The no-break space should prevent line breaks before and after. There
are some flaws in this area in browsers when a no-break space is
preceded or followed by a normal space.
But why would it be a _problem_ that line breaks are prevented, if you
want a specific placement of characters? To me, it seems like a
necessary part of a _solution_.
Then how about: <p>abcde</p><p>a e</p> ?
Since this was said to be computer output, markup like
<pre><samp>abcde
a e</samp></pre>
would appear to be adequate. If this won't do, the OP should explain why
not.
That should give you both the spacing and a possible break. I believe
you'd get the same effect (but with two break possibilities) if you
did: <p>abcde</p><p>a e</p> . (Not tested in all browsers.)
By the specifications, "a e" should have one break possibility
only, after the second space. Some browsers get this wrong. But I don't
see a reason for using such an approach.
It's only consecutive spaces that get collapsed.
As I mentioned above, no-break spaces may or may participate in the
collapse party. Currently they don't, but you have been warned:
"This specification does not indicate the behavior, rendering or
otherwise, of space characters other than those explicitly identified
here as white space characters [i.e. space, tab, form feed, zero-width
space]. For this reason, authors should use appropriate elements and
styles to achieve visual formatting effects that involve white space,
rather than space characters."
http://www.w3.org/TR/REC-html40/struct/text.html#h-9.1