March 15, 2005: Add content with CSS

I had a use for some flashy CSS 2.0 code the other day. I couldn't find it in my library, which was really annoying. I've decided to store various bits of handy code on here. Here's the first:

a:after {
   content: " (" attr(href) ") ";
   font-size: 80%;
   }

Add the content rule to anchors in your print stylesheet as aboue & you'll have lovely little URL's of each link placed in brackets after the link content.

This doesn't work on Internet Explorer though. Does work on Firefox. So think of is as an enhancement rather than rely on it.

Comments

1 | Will wrote at 13:44 on Friday 18 March, 2005

It's a cool little trick huh.

Best use I've found has been for print sylesheets, that way they get an idea of where the little underlined bit of text might actually go when they hold it in their hand.

Brilliant

2 | Jonathan Lee wrote at 22:02 on Thursday 01 December, 2005

A really neat little trick!

http://www.csschimp.com


Recent Entries

Categories

Archives

Links