CSS-Tricks PSD to HTML: You Design - We XHTML

How To Make Walking Links

While screwing around at the ol’ Zen Garden I ran into a pretty neat little effect for underlined links. We’ve talked about this before, but never incorporating animation.

A “walking link” is a link with a dotted underline created by a background image. Upon rollover or active state, the dots become animated and begin to walk. This is done with a simple image swap on hover or active state, with both background images being created from the same super-simple 3-pixel Photoshop file:

photoshopanimation.png

Regular state get the non-animated version, hover and active state get the animated version:

a, a:visited {
   background: url(images/dot.gif) repeat-x center bottom;
   text-decoration: none;
   padding-bottom: 2px;
   color: #900;
   }
   a:hover, a:active {
      background: url(images/dotwalk.gif) repeat-x center bottom;
   }

Check out the example to see it in action.

[VIEW EXAMPLE]


Theoretically Related Articles:

Discussion Elsewhere


Responses


  1. 1

    Gravatar

    Cool. Wouldn’t it be better if the two GIF files are combined into one?


    Comment by Lim Chee Aun — January 3, 2008 @ 8:18 pm

  2. 2

    Gravatar

    I agree with Lim. Use the sliding door method on the image and switch between a static and animated version. It would be just as easy to produce.


    Comment by Chad Payne — January 3, 2008 @ 8:58 pm

  3. 3

    Gravatar

    Interesting use of a rollover. Reminds me of all those crazy gif’s people used to and still do *cough* myspace *cough* all over the place in 1997.


    Comment by Chris S. — January 3, 2008 @ 9:13 pm

  4. 4

    Gravatar

    @Chad, the image would be larger and not as easily stretched. This way allows for any size link to be used.


    Comment by Chris S. — January 3, 2008 @ 9:14 pm

  5. 5

    Gravatar

    Don’t forget the :focus state ;-)


    Comment by Jeroen Mulder — January 4, 2008 @ 1:10 am

  6. 6

    Gravatar

    Thats a cool one Chris, i will be using in my new design :)


    Comment by Noura Yehia — January 4, 2008 @ 5:09 pm

  7. 7

    Gravatar

    That is interesting — I don’t know if I’d use it but it’s a clever use of a GIF.


    Comment by David Walsh — January 6, 2008 @ 5:25 pm

  8. 8

    Gravatar

    While it surely is cool, thing I do not like about it is the noise it creates!


    Comment by Jermayn Parker — January 6, 2008 @ 5:32 pm

  9. 9

    Gravatar

    It could be nice if used in particular areas on site, just to draw attention to those areas otherwise it will be noisy if used on all links.


    Comment by Noura Yehia — January 7, 2008 @ 4:25 am

  10. 10

    Gravatar

    From a getting attention prospective, I think it is a great way to separate yourself from all the others. I think people will definitely remember your website since the links will look totally different from all the others.


    Comment by Antonio Crutchley — January 14, 2008 @ 1:44 pm

  11. 11

    Gravatar

    The things that annoys me about these kind of links is the flickering it causes and the slight delay you experience, before the animation starts playing. Could surely be useful though…


    Comment by Anders — January 17, 2008 @ 6:04 am


Leave a comment

Sick of typing in all this info everytime you comment? Register or Login and save yourself time!

LINKS: You can use <a href="">LINK</a> tags here.
CODE SAMPLES: Please wrap code samples in BOTH <pre> and <code> tags.

Thank you for visiting CSS-Tricks! I'm glad you found an article useful enough to print out! Remember to visit css-tricks.com often for more fresh content.