SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Sep 2008
    Posts
    341
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <a href="">Anchor</a> into image

    This is a strange request, but hear goes:

    I have a file which has this in it:
    Code:
    <a href="http://www.google.com" class="google-link">Go to Google</a>
    // * it's not Google, but it gives an idea of what I am doing
    I then include that file in about five different sites (save re-writing it). There's more going on but this helps to explain it easier.

    Each of the sites can then have this in its own CSS file:
    .google-link {
    color: red;
    /* etc. */
    }

    Can I style it with an image and get rid of the text using only CSS? That way some sites can have the text link and some can have a bespoke image and I won't have to change the include file.

    I can of course just change it and write specific HTML for each site, but thought I would ask!

  2. #2

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,333
    Mentioned
    463 Post(s)
    Tagged
    8 Thread(s)
    You can use a simple image replacement technique, as demonstrated here:

    http://www.pmob.co.uk/temp/headerreplacement3.htm

    Just add in an empty span (or other inline element like <b></b> and use CSS to position this over the text.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •