Previous Message
Next Message

Re: [css-d] Text-decoration in :after content

Sent by Adam Kuehn on 27 September 2002 20:08


Moira Burke wrote:
>I'd like to show the URLs after my links in the printed version of my
>site.  While my links should be underlined, I don't want the URLs to be.
>Additionally, I don't want URLs to show up after linked images.  Neither
>seems to work properly (in Netscape 7); is it a browser bug or am I
>missing something?

These two problems have similar causes.

The underlines are still appearing because the generated content, 
although appearing "after the element's document tree content" as per 
the spec, still is considered by the UA to be within the scope of the 
anchor tag.  In other words, examine the following code:

<style>
a {text-decoration: underline;}
a span {text-decoration: none;}
</style>

<a>link with <span>lots of text</span> in it</a>

The text in the span will still have an underline, because although 
the span has no decoration, the decoration from the anchor continues 
throughout the entire element.  You can make this more clear by 
adding colors.  If the anchor color is red, and the span color is 
blue, the text in the span will be blue with a red underline.  This 
is the same problem with your generated content.  Effectively, you 
are getting:

<a>link text <span>(generated URL)</span></a>

In a surprisingly similar way, your specific selector isn't removing 
the generated content, either.  Instead, your specific selector is 
appending (well, inserting, actually) more generated content after 
your primary content.  In your case, of course, it is inserting the 
empty string, so you can't see any effect.  But if you change your 
specific selector to generate something other than the empty string, 
say "banana", you will end up with post-generation content that looks 
a bit like this:

<a>link text <span><span>banana</span>(generated URL)</span></a>

In your specific case, there's an image in there, but you get the general idea.

-
I'm not sure I see a good workaround, meaning a work-around that 
doesn't use a host of added tags and classes, for either of these 
problems.  Any suggestions out there?

-- 

-Adam Kuehn
Previous Message
Next Message

Message thread: