W3C home > Mailing lists > Public > www-style@w3.org > February 2004

[css3] Determining the first occurence of an attribute value

From: Jens Meiert <jens.meiert@erde3.com>
Date: Thu, 26 Feb 2004 12:26:05 +0100 (MET)
To: "W3C CSS" <www-style@w3.org>
Message-ID: <5446.1077794765@www35.gmx.net>

What ways are there to give more power to the 'content' property (that's
what I think is necessary) encountering e.g. the following scenario: Someone is
using several abbreviations on his page, and he wants to display the 'title'
attribute's value when the document is printed. In general, he could solve
this via:

    @media print {
    abbr::after, acronym::after { content: ' (' attr(title) ')'; }

But the situation becomes ugly when he wants to extract the 'title' only
once each abbreviation occurs, so he has (and that's AFAIR the only way to
achieve the desired effect yet) to specify something like (media dependence
assumed here, too):

    acronym[title='World Wide Web Consortium']::after:first-child,
    acronym[title='World Wide Web']::after:first-child,
    abbr[title='Massachusetts']::after:first-child {
    content: ' (' attr(title) ')';

So what can he do? In this case (and assuming there are many abbreviations
and acronyms in use) it would be really evil to get e.g. hundred explanations
of the same term when printing the document, but the author wants to write
accessible code and likes to offer a good print version (it doesn't matter what
he wants to do, and I assume that it's a feature which nonetheless would be
quite useful).

Are there already ways to solve this problem elegantly? What do you propose,
ain't there the need to create a solution for this? For example, it could be
considered to allow one, two keywords for the 'content' property, like e.g.
'once' and 'always' with 'always' being the initial value:

    abbr::after, acronym::after { content: ' (' attr(title) ')' once; }

...and thus only applying the selector once each *attribute value* occurs. I
didn't think about further implications, so this is only 'a shot in the
sky'. What do you suggest?

All the best,

Jens Meiert
Interface Architect

Received on Thursday, 26 February 2004 06:26:06 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:11 UTC