W3C home > Mailing lists > Public > www-style@w3.org > November 2010

RE: [css3-content] [css21-content] Syntax for adding alternative text for inserted image

From: Anton Prowse <prowse@moonhenge.net>
Date: Thu, 25 Nov 2010 18:41:30 +0100
Message-ID: <4CEE9FCA.4090409@moonhenge.net>
To: www-style@w3.org
>On Fri, 19 Nov 2010 15:05:17 François REMY wrote
>> Date: Fri, 19 Nov 2010 08:24:48 -0500
>> From: bzbarsky@MIT.EDU
>> Uh... If you need to add alt text, then the image has semantic meaning;
>> it's not just a decoration.
>> If it has semantic meaning, then adding it via CSS is just wrong. In
>> particular, it'll break badly in a UA that just doesn't load your CSS.
>> So there is no way to the alt text, because if you need to do it, you're
>> misusing the feature badly.
> I don't completely agree with you.
> CSS is supposed to be an acceptable way of styling XML documents.
> Suppose you have something like that
> <books>
> <book new="true">My new book</book>
> <book new="false">My second book</book>
> <book new="false">My first book</book>
> </books>
> You would like to write something like
> book[new="true"]::before {
>      content: image(url('new.gif),'New: ');
> }
> I think it would be legitimate.

I don't see how things are any different when it's XML.

The fact remains that if the word 'New: ' is important to the complete 
understanding of the document (possibly after conversion of the document 
to a suitable format for consumption) then it needs to be a first-class 
part of the (possibly converted) document.  And then those consumers 
with the capability and desire for progressive enhancement might have 
the text replaced by the image.

If the word isn't important then alt text isn't necessary anyway.

(Note that its impossible to say from the example whether the word might 
be important, since it depends entirely on the context in which the 
underlying XML data is being published.  The situation is identical to 
alt text for images where ‒ and this is so frequently misunderstood by 
web developers and CMS developers alike ‒ the alt text is not a property 
of the image but rather a property of the image /in its current context/.)

> (Naturally, you could use a XSL stylesheet to perform a first transformation to your XML document but it would require more work)

Indeed, that's what's probably required if the alt text is necessary. 
That fact that it would require more work is neither here nor there.

Anton Prowse
Received on Thursday, 25 November 2010 17:42:06 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:41 UTC