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

Re: [CSS3 proposal] 'replace-by-image' property

From: Mike Bremford <mike-css@bfo.co.uk>
Date: Wed, 1 Aug 2007 12:43:30 +0100
Message-Id: <29C1E9B8-A129-4639-B579-DBD1A40E0EA2@bfo.co.uk>
To: www-style <www-style@w3.org>

This is already covered in the CSS3 "generated content" draft: http:// 
www.w3.org/TR/css3-content/#inserting3

@media screen {
     a { content:url(mail.png) "Mail" }
}
@media print {
     a { content:"Mail" }
}

<a class="mail" href="mailto:a@b.c"></a>

would achieve what you want: on screen, the content of the <a> tag  
will be set to the URL if it's found, and the text "Mail" if it's not.

Cheers... Mike


On 1 Aug 2007, at 11:42, Nikodem wrote:

>
> I think that [X]HTML image tag <img src="..." /> is OK for content- 
> related images (photos for articles etc.), but not for navigation  
> (<ul><li><a href="mailto:a@b.c"><img src="mail.png" alt="Mail" /></ 
> a></li></ul>), where it is going to be a little presentational. It  
> could be made so:
>
> 	<style type="text/css">
> 	ul li#mail{replace-by-image:url("mail.png");}
> 	@media print{ul li#mail{replace-by-image:none;}}
> 	</style>
>
> 	<ul><li id="mail"><a href="mailto:a@b.c">Mail</a></li></ul>
>
> If the image could not be loaded (or document would be printed), then
> only text would be displayed, otherwise there would appear mail.png  
> image.
>
> That gives a possibility of editing look of page only from CSS, not  
> [X]HTML. Earlier I had many problems with making printable versions  
> of page (e.g. overriding logo by black'n'white version was  
> requiring separated printable version in another HTML document).
>
> -- 
> Nikodem
> JID: nikn@jabber.org
>
> --
> Opole - Miasto Bez Granic.
> http://www.opole.pl - tu znajdziesz nowe miejsca, nowe możliwości,  
> nowe inspiracje...
>
>
Received on Wednesday, 1 August 2007 11:44:05 GMT

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