You are currently browsing the page Custom underlines in the CSS category.

Custom underlines

Idea from A List Apart.

First, open your graphics editor, make a custom line, I recommend you to not use one bigger than 3px in height. I've made a few for you to use, you can find them at the end of the tutorial, you can always replace the colors, of course.

link example, another example, here we go, again, and finally, the last one.

Well, that's nice, but what's the code?

a {
text-decoration: none;
background: url(underline.gif) repeat-x left bottom;
padding-bottom: 2px;
}

Set your underline as background, make it repeat horizontally only (repeat-x) and set its position to left horizontally and bottom vertically. This is nice, but how do I do animated rollovers? It's simple, make an animated underline, and put it as background using this code:

a:hover {
text-decoration: none;
background: url(underline_over.gif) repeat-x left bottom;
}

Same as previously, make it repeat horizontally only, etc.

Download: Underlines set  Underlines set (906 bytes, 239 hits)

Print This Post Print This Post



Sponsors


Leave a Comment

Works? Doesn't work? Other tips? Please leave a comment! :)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

To post codes, please go to SimpleCode and transform your codes first, so that it will displayed properly. Indeed, < and > need to be converted to &lt; and &gt; :)


Close
E-mail It