W3C home > Mailing lists > Public > www-style@w3.org > May 2001

Re: first-word pseudo-element

From: Peter S. Linss <peter@linss.com>
Date: Thu, 17 May 2001 11:28:33 -0700
Message-ID: <3B041851.814B4AF7@linss.com>
To: Chris Wilson <cwilso@microsoft.com>
CC: www-style@w3.org

Chris Wilson wrote:

> And, in fact, it's somewhat contradictory, because CSS already claims to
> know what a "word" is, at least in some contexts - due to the
> 'word-spacing' property.  :^)

Yes, it's an issue that can't simply be ignored for lack of a universal
definition. Words exist in many languages used on the web, we should be able
to style them.

> That said, ":first-word" would be a one-off.  I'd be much more
> interested in a ":first-n-words" and ":first-n-letters".

Agreed. Also first-n-lines.

Another (and more commonly used IMHO) styling effect is to to differentiate
the first n words that are within (or intersect with) a given geometric
region. For example, in books and magazines the first 2 inches of words on
the first line are often bold.

This might also be done via a pseudo element, for instance (feel free to
suggest a better name):

p::leading-box { width: 2in; font-weight: bold; }


p::leading-box { width: 50%; font-weight: bold; }

The leading box could default to the first line if not otherwise specified.
And no, you wouldn't break words with this box, nobody styles half a word
like that. The box would grow as needed to enclose the last word that
started within it.


> -----Original Message-----
> From: Peter S. Linss [mailto:peter@linss.com]
> Sent: Thursday, May 17, 2001 9:44 AM
> To: Daniel Glazman
> Cc: www-style@w3.org
> Subject: Re: first-word pseudo-element
> And that answer always bothered me. I accept that a UA can't always
> determine
> what a word is (or that the selected element may not even contain
> words), but so
> what? Why can't the pseudo element simply be defined to only apply to
> those
> elements where the UA can determine what a word is? (and maybe define a
> word in
> the cases where it can be defined, or at least make a note that UAs
> should be
> careful about what languages they apply this selector to, so that they
> don't
> just look for spaces in Japanese text, for instance)
> Not all of CSS makes sense in all circumstances, it's unnecessarily
> limiting to
> try to pretend that it has to. What does the ::first-line selector
> select in an
> audio-only presentation?
> Daniel Glazman wrote:
> > andrew.robertson@capitaes.co.uk wrote:
> >
> > >Would there be any benefit in adding a :first-word pseudo element to
> format
> > >the first word of a paragraph, to the CSS3 spec?
> > >
> > It is an old question, posted in this mailing-list ona  regular basis.
> > My answer, posted also on a regular basis, is the following one : what
> > is a word ? In our western languages and writings, it is quite easy
> (but
> > not always) to determine it.
> > Now think of asian languages and writing systems, sometimes without
> > punctuation, or think of a text mixing writing systems, ...
> >
> > </Daniel>
Received on Thursday, 17 May 2001 14:30:47 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:57 UTC