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.

2 thoughts on “Add content with CSS”

  1. 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.


Comments are closed.