Grow your CSS skills. Land your dream job.

How To Make Walking Links

Published by Chris Coyier

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]

Comments

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

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

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

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

  5. Don’t forget the :focus state ;-)

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

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

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

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

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

  11. Anders
    Permalink to comment#

    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…

This comment thread is closed. If you have important information to share, you can always contact me.

*May or may not contain any actual "CSS" or "Tricks".