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

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

From: Giovanni Campagna <scampa.giovanni@gmail.com>
Date: Wed, 2 Sep 2009 22:58:49 +0200
Message-ID: <65307430909021358i52576365oa187ba60fd535b95@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Bert Bos <bert@w3.org>, www-style@w3.org
2009/9/2 Tab Atkins Jr. <jackalmage@gmail.com>:
> On Wed, Sep 2, 2009 at 1:01 PM, Bert Bos<bert@w3.org> wrote:
>> 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.
>
> To an extent.  I think that reasonably common typographic effects on
> first-lines include small-caps and increases in letter-spacing, both
> of which can be reasonably applied to a run-in header without removing
> the 'header-ness' of it (which is often conveyed through weight or
> size).
>
> So, let's talk typographic convention.  First: in normal typography,
> is the header styled identically as a block and run-in?  I think not -
> at the very least, block headers are usually substantially bigger than
> the surrounding body text, while run-in headers are equal size or only
> slightly larger.  So, there's a vote for having *some* mechanism of
> styling a header differently when it's a run-in.

If you said display:run-in, then it will run in, and you can style it
appropriately.
In fact, you can infer from the source and style if the element will
effectively run in, or if it will became a block (you know what the
following element is, what are the contents of the run-in header,
etc.). Using creative selectors (especially those available in CSS4,
like :has() or :precedes()) you can even get different styles in case
you assign display:run-in to all your <h1>s.

> Second: when headers are run-in with a specially styled first-line,
> are they styled the same?  You yourself suggest that they are not, and
> I agree.  While some styles are shared (my point two paragraphs ago),
> some properties are sufficiently different so that you can still
> visually tell the header apart from the content.  So, that suggests
> that using ::first-line on run-in headers isn't sufficient, at least
> on its own.

I don't understand what you mean. Bert said that using ::first-line on
run-in is just wrong, or anyway it won't be used much.

> This points to the idea that we need a way to target headers with
> styles based on whether they're running-in or staying block.  The
> first idea that comes to mind is a :running-in pseudoclass on the
> header that matches whenever the header is running-in.  This seems
> like a good idea, but is it enough?  Can this by itself solve the
> styling issue so we can go with Option A and just sidestep the
> inheritance issue?

See above: creative selectors plus knowledge of the source and style.
Plus, I think you can forget about:
- new features for CSS2 or Selectors3
- pseudo-classes based on the formatting structure (they cause
circular dependencies)

> By itself, I think yes.  It does mean duplicating the shared
> properties between p::first-line and h1:running-in, but that's not too
> bad.  However, the ::first-letter issue makes this more complex.  When
> I'm using ::first-letter, I can say unambiguously that I expect it to
> apply to a running-in header.  It would be really weird and probably
> complicate things more in the future if ::first-letter and
> ::first-line affected different text.  So, for typographical and
> mental consistency reasons, Option B looks like the best plan.
> (Option C just punts the issue and disallows valid and useful visual
> techniques.)

I think that Option B is what makes more sense, since the run-in is on
the first formatted line, right?
And it allows you to override properties from :first-letter that you
don't like by setting them explicitly on the run-in.

> So, I propose that ::first-line and ::first-letter *do* include run-in
> headers.  For purposes of inheritance, ::first-line is higher than the
> header while it's running-in (::first-letter is as low as possible, as
> usual).  I also propose that a :running-in pseudoclass be added which
> matches only elements which are display:run-in and are currently
> exhibiting the run-in behavior (acting as inlines in the following
> block).
>
>
> ~TJ
>
>

Giovanni
Received on Wednesday, 2 September 2009 20:59:30 GMT

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