How to create clickable links in sIFR3

sIFR 3 is a great way to embed a font in a website. sIFR 3 uses a combination of Flash, CSS and javascript to dynamically display fonts on your website. It’s quite simple to use sIFR 3 to embed a font in a heading on your website like a h1, h2, or h3 element. But what about when you want to make that heading into a clickable link? Can sIFR 3 be used to create a clickable link? Yes it can, and it’s quite simple to set up.

I’ll assume that you have already set up sIFR 3 on your website and it is working fine for your headings. As an example lets say that you have embedded the “Georgia” font in your “h1” tags on your website and they are working. But you would like your headings to be links to other pages on your website. Below are a few steps to create clickable links with sIFR 3 that you can style with hover effects using CSS.

  1. Let’s put the link tag around our h1 heading like so.
    <h1><a href="yourlinkgoeshere">Your Heading Text</a></h1>
  2. Doing this results in the heading text turning the ugly default blue link colour with an underline, so we need to style it.
    default-sifr3-link
  3. Now let’s add the h1 styles to our main CSS stylesheet. Make sure the h1 element has a height. It will look something like this:
    h1{
    font-size:36px;
    color:#FFFFFF;
    height:45px;
    }
    
  4. Find the “sIFR.replace” function (it should be at the bottom of your sifr.js file) and add the following styles so that your function looks something like the one below. This will allow you to style your sIFR link text.
    sIFR.replace(georgia,{
    selector:'h1',
    wmode:'transparent',
    css:['.sIFR-root { color: #ffffff; }',
    '.sIFR-root a { color: #ffffff; text-decoration: none; }',
    '.sIFR-root a:hover { color: #ffffff; text-decoration: none; }',
    '.sIFR-root a:visited { color: #ffffff; text-decoration: none; }']
    });
    
  5. You can add more styles if you like but these are the basic styles to control your links. I have made mine white links with no text decoration or hover effects.

So that’s how you can create links with sIFR 3 that you can style with some simple CSS.

Adham Dannaway

Yep, that's me. I'm a Web Designer and Blogger from Sydney Australia with a passion for noodles, beer and design. Check out my other sites: Mac or PC, illumin8 Design

Follow me on Twitter »

Tags: , , , , ,

  • Stumbleupon Cre8ive Commando
  • Delicious
    • Share/Bookmark

  1. Joko Ruwhof on Tuesday 9, 2009

    Halleluja! It worked! I’ve been searching and debugging for hours and stumbled upon your solution. Yes! Thanks!

  2. Cre8ive Commando on Tuesday 9, 2009

    That’s great Joko :-)

  3. Verena on Tuesday 9, 2009

    oh man THANK YOU SO MUCH!! you saved my life!!

  4. [...] is sometimes difficult to create a link from text that uses sIFR [...]

  5. Ben Harrison on Tuesday 9, 2009

    Brilliant thanks! Been searching for DAYS for a solution to this and finally found this page. Top man!

  6. nandroid on Tuesday 9, 2009

    It works!!
    Great!!

    THANK YOU!!

  7. Tschy on Tuesday 9, 2009

    cool – does this work in all browsers and IE-versions and in all flashplayer-versions ? very curious about that! thx!

  8. Cre8ive Commando on Tuesday 9, 2009

    @Tschy – I have tested it out on most of the main browsers (IE 6,7 and 8, Firefox, Safari) and it works fine.

    You can try saving your SWF font file as an older version of Flash if you’re worried about compatibility although that will limit the amount of filter effects you can apply to your flash fonts.

    Hope that helps :-)

  9. Tschy on Tuesday 9, 2009

    @Cre8ive Commando: yes, it helped!
    THANK YOU! =)

  10. keekoon on Tuesday 9, 2009

    A huge thank you !
    keekoon

  11. Jake on Tuesday 9, 2009

    Works great! This was located in my sifr-config.js file.


Subscribe to Cre8ive Commando RSS
Follow Cre8ive Commando on Twitter