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

Re: [CSS2 counters] Is it possible to evaluate a value inside CSS?

From: Andrew Fedoniouk <news@terrainformatica.com>
Date: Mon, 15 May 2006 13:57:34 -0700
Message-ID: <006501c67862$310028e0$c302000a@internal.toppro.net>
To: <www-style@w3.org>, "Daniel MD" <danielmendes@im-thinking.com>


----- Original Message ----- 
From: "Daniel MD" <danielmendes@im-thinking.com>
To: <www-style@w3.org>
Sent: Monday, May 15, 2006 10:39 AM
Subject: [CSS2 counters] Is it possible to evaluate a value inside CSS?


| 
| Hi,
| 
| I am trying to do some tricks in CSS, one of them is to use different 
| bullet images programmatically using a CSS counter, so i have a 
| folder called bullets with 1.gif, 2.gif, etc.... I don't know if it 
| is possible to do in CSS, i have tried several ways but i think i am 
| not getting the way the list gets created... or perhaps this is not 
| possible, what i want to do is for the content: propriety to 
| evaluate/return url(1.gif) [see code below]
| 
| Using it directly (content:url(1.gif)) works fine... is there a way 
| to do this, how do i create a "fake" variable with a counter?
| 
| ol {
| counter-reset: list 0;
| list-style:none; 
| }
| li:before{
| content: url( counter(list,decimal).gif ); //also tried 
| url(counter(list,decimal))".gif";
| counter-increment: list;
| }
| 

Wwhy not to define
 
li:nth-child( 1 ) ... {  background-image: url(1.gif);  }
li:nth-child( 2 ) ... {  background-image: url(2.gif);  }
li:nth-child( 3 ) ... {  background-image: url(3.gif);  }

and so forth? A bit noisy but will work...


Andrew Fedoniouk.
http://terrainformatica.com
Received on Monday, 15 May 2006 20:57:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:45 GMT