Curly underline

Ever wanted to use un underline on a web page that looks like a spelling mistake in Word? You know, the curly red underline. It's actually very easy.

Here's an example.

All you need is:

  • A small piece of the wavy line, like this Curly underline (it's stretched here for the demo purpose)
  • A style that uses the image as background
  • Align the background at the bottom and repeat only on the x-axis

The style definition would look like:

.curly-underline {
    background: url(underline.gif) bottom repeat-x;
}

And that's it!

I saw this working in TinyMCE, the WYSIWYG editor used by WordPress, for displaying spelling mistakes. Really cool!

Note: If you're a frequent visitor to my site and the example doesn't work for you, chances are you're using a cached version of the CSS file.

This entry was posted on Tuesday, April 4th, 2006 and is filed under CSS. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


Get notification for future posts: follow me on Twitter or subscribe to my RSS feed

8 Responses to “Curly underline”

  1. Ivailo Says:

    Nice.

  2. wael Says:

    smart :)

  3. Oliver Clevont Says:

    What about your CSS coding conventions? Shouldn’t you be writing:

    .curly-underline {
    background-image: url(underline.gif);
    background-position: bottom;
    background-repeat: repeat-x;
    }

  4. Stoyan Says:

    Very true, Oliver :D

  5. Albert Says:

    Great!! just what I was looking for, I cannot thank you enough!

  6. Stephen Says:

    Clean – good-looking thank you

  7. heart rate monitor watches Says:

    http://www.heartratemonitorguides.com/heart-rate-monitor-watches.php Thanks for that awesome posting. It saved MUCH time :-)

  8. Jorge Says:

    Thanks a lot!

Leave a Reply