W3C home > Mailing lists > Public > www-style@w3.org > September 2009

Re: [CSS21] display:run-in clarifications - run-in and :first-line

From: Bert Bos <bert@w3.org>
Date: Wed, 2 Sep 2009 20:01:29 +0200
To: www-style@w3.org
Message-Id: <200909022001.30478.bert@w3.org>
Combining run-in headings with first-line styling may no doubt give 
interesting effects (at least interesting challenges for 
implementers :-) ), but I can't remember ever having seen it in use. 
That is no doubt because such a thing is difficult to recognize: if you 
apply a first-line style to a paragraph, then it becomes difficult to 
see that the paragraph starts with a heading. Which means, in effect, 
that combining these effects is bad typography.

In other words: CSS needs to say something definite about the situation, 
but it doesn't matter much *what* it says.

As a reminder, the properties that affect first-line are:

  - font properties,
  - color property,
  - background properties,
  - word-spacing,
  - letter-spacing,
  - text-decoration,
  - vertical-align,
  - text-transform, and
  - line-height.

The first formatted line has content coming from two different elements: 
the run-in heading and the paragraph. (Either may be empty, of course.) 
We need to define what the property values are on both kinds of 
content.

The possible sources of those property values are:

  1) The heading element
  2) The paragraph element
  3) Their ancestor elements
  4) The paragraph's first-line pseudo-element
  5) The ancestors' first-line pseudo-elements

Source (5) only includes those ancestors for which the present line is 
indeed the first formatted line. There isn't always such an ancestor. 
Note that the heading itself doesn't have a first-line pseudo-element, 
because when it is run-in it isn't a block-level element.

I think there are three options. (And at the moment I don't know which 
one I prefer...)


Option A) The run-in heading is *not* affected by the paragraph's 
first-line pseudo-element. The inheritance hierarchies are:

    ancestor elements (3)
      the heading element (1)
        ancestors' first-line pseudo-elements (5)
          [content from the run-in heading]

and:

    ancestor elements (3)
      the paragraph element (2)
        ancestors' first-line pseudo-elements (5)
          the paragraph's first-line pseudo-element (4)
            [content from the paragraph]


Option B) The run-in heading *is* affected by the paragraph's first-line 
pseudo-element. The inheritance hierarchies are:

    ancestor elements (3)
      the heading element (1)
        ancestors' first-line pseudo-elements (5)
          the paragraph's first-line pseudo-element (4)
            [content from the run-in heading]

and:

    ancestor elements (3)
      the paragraph element (2)
        ancestors' first-line pseudo-elements (5)
          the paragraph's first-line pseudo-element (4)
            [content from the paragraph]


Option C) First-line pseudo-elements do not apply to blocks with run-in 
headers. The inheritance hierarchies are simply:

    ancestor elements (3)
      the heading element (1)
        [content from the run-in heading]

and:

    ancestor elements (3)
      the paragraph element (2)
        [content from the paragraph]


Any other options?

(I have the suspicion that choosing an option here will automatically 
impose a choice for first-letter, but I haven't thought about 
first-letter yet.)



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 Wednesday, 2 September 2009 18:03:48 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:20 GMT