Re: [css3-text] Feature request: "white-space: ignore"

On Tuesday 18 December 2012 23:55:30 Zack Weinberg wrote:

> The whitespace node comes from pretty-printing of the HTML source and
> was not intended to be significant.  It would be nice if there were a
> way to tell the renderer not to allocate any space for such
> unintentional nodes.  A "white-space" value seems like the logical
> place to put that way; I suggest "white-space:ignore".  There is a
> slight awkwardness in that 'white-space' inherits, so it would be
> necessary in this example to mark the inner divs as
> white-space:normal explicitly, but I think we can probably live with
> that.

I have often wanted such a value myself and at one point we even had a 
proposal for it: 'text-space-collapse: discard'. (I think it would be 
easier to understand as part of 'white-space' though.)

E.g., this is a common case I want it for:

    <dl>
      <dt>term1<dt>
      <dt>term2</dt>
      <dd>Definition of term1/term2.
      ...
    </dl>

And I want this displayed as

    term1, term2
      Definition of term/1term2.

with the DTs on one line with a comma and a space between them.

In HTML4, the following worked (although not in browsers):

    dt {display: inline}
    dt + dt::before {content: ", "}

But in HTML5, the result is this:

    term1 , term2
      Definition of term/1term2.

A 'white-space: ignore' could remove the unwanted space, although it is 
not completely intuitive, because, as you said, the 'ignore' value 
should typically not be inherited:

    dl {white-space: ignore}
    dt, dd {white-space: normal}

The same problem led us to put special rules in CSS for white space in 
tables, but that only helps with tables, not with inline boxes.



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos                               W3C/ERCIM
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France

Received on Friday, 29 March 2013 14:39:15 UTC