Someone I know came to me with a problem: he wants his print
stylesheet to not apply a style when a link contains an image.

Here's some sample HTML to explain the problem:

<a id="anchor" name="anchor"></a>
<p><a href="http://flickr.com";><img
src="http://flickr.com/foo/picture-ID"; /></a></p>
<p>Here is an <a href="http://example.com";>example link</a>.</p>

His CSS puts in generated content:

a[href]:before {
    content: " [";
    color: #000;
    text-decoration: none;
    }

a[href]:after {
    content: " " attr(href) "] ";
    color: #000;
    text-decoration: none;
    }*/

The generated content appears around the example link AND the linked
image when you print it. He doesn't want it to appear around the
linked image.

I thought that using the :not selector was the solution:
a:not([href*="flickr"]):before {
    content: " [";
    color: #000;
    text-decoration: none;
}
a:not([href*="flickr"]):after {
        content: " " attr(href) "] ";
    color: #000;
    text-decoration: none;
}

But there are two obvious problems:
1. Anchor links are now getting generated brackets thrown around them
2. If he switches away from Flickr or links to an image on a
non-Flickr, he has to add a new exception every time

I know there's a way in XSLT to test for a child element, but it
doesn't seem like you can do the same in CSS.

Is there a simple, elegant solution I'm missing here?
dw

-- 
Dylan Wilbanks
Seattle, WA
Wired since 1972. Online since 1992.
http://clientandserver.com || http://seattle.metblogs.com
______________________________________________________________________
css-discuss [cs...@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to