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.

Bookmark and Share

Somewhat related posts

5 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

Leave a Reply