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

Re: [css3-gcpm] counter() and "special" values

From: Håkon Wium Lie <howcome@opera.com>
Date: Wed, 30 May 2007 12:49:12 +0200
Message-ID: <18013.22184.258873.595103@gargle.gargle.HOWL>
To: Michael Day <mikeday@yeslogic.com>
Cc: del@alum.mit.edu, www-style@w3.org

Also sprach Michael Day:

 > >    Are there any specially named values for counters?
 > > 
 > > E.g., can I generate content like this:
 > > 
 > >    content: "Page " counter(page) " of " counter(pages)
 > Prince treats "page", "pages", "footnote" and "list-item" as special 
 > counter values.

Right, so the above code works in Prince. 

 > However, I don't think the specifications define all these yet. There 
 > was a pages() function in a past draft of CSS3 Paged Media at one stage 
 > I believe.

In the Paged Media draft from 2004, the "page" and "pages" counters
were defined:


The "page" counter is still referred to in the latest draft:


But the magic is gone. That is, there is no text that prescribes the
creation of a counter called "page" unless it appears explicitly. Is
this what we want?

The main argument for a magic solution is that style sheets can be
shorter and that more things can be achieved. In the magic version,
your code would simply work:

   @page { @bottom-center {
     content: "Page " counter(page) " of " counter(pages);

In a version without magic, you would be abe to say:

   @page { counter-increment: page { @bottom-center {
     content: "Page " counter(page) " of " counter(pages);

However, you would not get the total page count. This is a
requirement, I believe. We could introduce functions:

   @page { counter-increment: page { @bottom-center {
     content: "Page " counter(page) " of " pages();

The magic is still there, but it it has been moved out of the
namespace for counters and into a function. Percievebly, we could add
other functions like date() and time() later.

Personally, I'm leaning towards defining the name of certain magic
counters in the GCPM draft.


What do others think?

              Håkon Wium Lie                          CTO °þe®ª
howcome@opera.com                  http://people.opera.com/howcome
Received on Wednesday, 30 May 2007 10:49:44 UTC

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