Re: attr(x, y)

David Woolley wrote:

>>   color: rgb(attr(r,number),attr(g,number),attr(b,number),attr(a,number));
> 
> You need a better example.  This looks like a violation of the principle
> of separating content from style in that you have the actual red, green
> and blue values as attributes of the content.

How about...

h1.pagetitle {
   content: url("/dynamicTitleImage.php?text=" contents), contents;
   }

Now to play devil's advocate...

Regarding the comments above, while I agree that most of the time RGB 
values have no place in content, it depends on the content. Imagine a 
color chart in list form.

<li r="0" b="0" g="0">Color name 1</li>
<li r="0" b="0" g="1">Color name 2</li>
<li r="0" b="0" g="2">Color name 3</li>
<li r="0" b="0" g="3">Color name 4</li>
...
<li r="0" b="0" g="255">Color name 256</li>
<li r="0" b="1" g="0">Color name 257</li>
<li r="0" b="1" g="1">Color name 258</li>
...

li:before {
   width:1em;
   height:1em;
   margin-right:0.5em;
   background-color: rgb(attr(r,number),attr(g,number),attr(b,number));
   }

I'm not sure though, would the ":before" selector be able to inherit 
"attr()" from its parent element? Seems like it would since it can't 
have attributes of its own.

Cheers,
James Craig

-- 
http://www.cookiecrook.com/

Received on Friday, 26 September 2003 12:36:16 UTC