Two columns Three columns Mixed cols and rows Gallery Archives Clean & Clear Dark or Black High Contrast/ Impact Blog Designs New Corporate/ Professional Unconventional Designs Liquid layouts Web Design Firms Our Favorites What's Popular Last 20 submissions
Horizontal Menus Vertical Menus Multiple/ Nested Levels

CSS Examples Borderize links onMouseover

Date: 10/14/2004 Borderize links onMouseover

Author: CSS Drive

The goal of CSS link effects is often to draw attention to a link when the user hovers over it. Using the pseudo class "a:hover", this one applies a border to the target link, and for good measure, changes its background color as well. Notice how by setting the links to "display: block", the entire link area- and not just the text- becomes "active."

The HTML:

<div id="borderlinks">
<a href="http://www.cssdrive.com">CSS Drive</a>
<a href="http://www.javascriptkit.com/jsref/">JavaScript Reference</a>
<a href="http://www.google.com">Google</a>
<a href="http://www.yahoo.com">Yahoo</a>
</div>

The CSS:

#borderlinks a{
padding-left: 4px;
display: block;
width: 150px;
color: black;
text-decoration: none;
border: 1px solid white;
}

#borderlinks a:hover{
border: 1px solid black;
background-color: lightyellow;
}

Comments (10)

Good post! Thanks for the info

#1: Nikola on 08/26 at 08:15 AM

Yeah. great post. thanks

#2: gratis on 09/04 at 04:56 PM

simple and useful.

#3: roses on 09/20 at 03:36 AM

Great one.I am using it : ) thanks
Games

#4: John on 11/21 at 07:59 AM

Wonderful article, thank you so much.

#5: videolar on 12/04 at 10:58 AM

Thanks, very simple and usable and it looks great too. I love css and what you can do with it. It is much simpler than using javascript which I have a lot of trouble understanding.
Acne Treatments

#6: Jake on 12/13 at 03:25 AM

I love how easily you can use CSS to get some really cool mouseover effects. Thanks for the useful tips - I love your site, keep up the great work. - Editor (Make Money Online Site)

#7: Jenny P. on 01/15 at 05:41 AM

Damnit I have been trying to find that code forever - thanks~

#8: Money on 02/25 at 12:22 AM

thanks css drive. you are best!

#9: emlak on 03/04 at 09:01 AM

nice and simple code thanks i was looking for this

#10: wayzee on 05/04 at 06:50 AM

CSS Forums

CSS Forums: latest threads Last Post Info
Free Wordpress Theme - Gambling Stitches (1) 08/20/2008 05:32 pm
By: topwpsites
Web Design Co Redesign (1) 08/19/2008 12:23 pm
By: slapaddicts
Please review my website (2) 08/19/2008 02:31 am
By: webdesignernew
Please Review AdsGlobe.com – Free Ads Globally (1) 08/19/2008 02:29 am
By: kaiz49
Not a full review (2) 08/19/2008 02:27 am
By: webdesignernew