Re: Hanging indent

The CSS working group talked about hanging indents a little, but is
not convinced there is a strong enough case for adding a new property
or a new type of value.

1) People may indeed overlook the fact that 'text-indent' can be
negative and some prople may have trouble imagining negative values at
all, but most of that problem can be solved by giving an example in
the spec and making sure that there are sufficient examples elsewhere.

The example would go something like this:

    HANGING INDENTATION

    To "outdent" the first line, add the desired indentation to the
    'padding-left' property and then use the 'text-indent' property to
    negate the indentation for the first line:

        p {padding-left: 1em; text-indent: -1em}

2) Fantasai pointed out the problem that 'text-indent' inherits but
'padding' does not and that you can therefore end up with some nested
block that you didn't foresee and therefore didn't put a padding on.
This can indeed not be fully solved with the current properties, but
in practice it seems to be very rare.

If you notice an unwanted inheritance effect, you can often suppress
it with:

    * {text-indent: 0}

3) An extra property, say 'text-outdent' or 'text-hang', that would
complement 'text-indent' by adding an indent to all lines except the
first, would be a relatively easy to understand solution. But it would
still be an extra property to deal with.

4) Extending the value of 'text-indent' to something like
'text-indent: 1em hanging', as Etan Wexler suggested, would keep the
number of properties the same, but it would still mean the
specification would have to define what happens to such indent, e.g.,
when there are floats to the left of the line.

E.g., CSS3 might have a 'float-displace' property[1] that can change
the indentation of text next to floats. It would have to say something
about hanging indents as well.

[1] http://www.w3.org/TR/css3-box/#the-float-displace

5) Properties with compound values ('1em hanging') work well for
people writing CSS, but they do pose problems for the DOM and thus for
people accessing style rules through the DOM. The usability of CSS is
probably the first concern, but the usability of the DOM is also
important.

6) Both solutions, a new property and a new value for 'text-indent',
would also have a problem with backwards compatibility, because CSS2
implementations would not show any effect at all, neither an indent
nor an outdent.

In short, the working group would like to see more convincing
examples, before trying to add anything to CSS3.



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

Received on Monday, 3 June 2002 15:51:55 UTC