On Hover

They have: 41 posts

Joined: Feb 2004

I hate the way the links all have lines underneath them, and use to use a javascript to get rid of them, and then when a user put the cursor over the link it would underline it, and change it a different colour.

I got rid of that on accident.

Anyone know any code I could use, or css code I can use?

HostNifty
Quality shared and reseller UK hosting
http://www.hostnifty.co.uk

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

a:link { text-decoration: none; }
a:hover { text-decoration: underline; color: #hex;}
'

They have: 41 posts

Joined: Feb 2004

thanks

They have: 41 posts

Joined: Feb 2004

The only problem with that is when I have clicked a link it shows a a normal link with a line underneath.

I tried adding this:

a:visited { text-decoration: none; }

and it showed the link without the line, but when you hover over it, it didnt show the line.

What I want is the line to show no matter what when you hover over the link.

HostNifty
Quality shared and reseller UK hosting
http://www.hostnifty.co.uk

s0da's picture

He has: 157 posts

Joined: Mar 2004

what? you stated that you wanted no lines in a link until it's hovered over. NOW... you want lines in a link even if it's hovered over.

a {text-decoration: underline; }
a:hover { color: red; }
'

Links:
http://www.w3schools.com/css/default.asp

They have: 41 posts

Joined: Feb 2004

no..

What I want is no lines under a link until it is hovered over. AND, when I click a link I still want no lines underneath until it is hovered over.

What I mean is:

When I hover over a link I want it underlined.

With the CSS code you gave me before, it worked fine until you clicked on a link. Clicking on it made it a visited link, and the link then was underlined without hovering over it. I used - a:visited { text-decoration: none; } and it got rid of the underline of the visited link. But when I hovered over the visited link it had no underline.

Understand me now?

HostNifty
Quality shared and reseller UK hosting
http://www.hostnifty.co.uk

s0da's picture

He has: 157 posts

Joined: Mar 2004

okay, here's some code... you can figure it out i'm sure. either none or underline for the link tag.

a:link { text-decoration: none|underline; }
a:visited { text-decoration: none|underline; }
a:active { text-decoration: none|underline; }
a:hover { text-decoration: none|underline; }
'

Busy's picture

He has: 6,151 posts

Joined: May 2001

make them all text-decoration:none except hover, make that text-decoration:underline or leave the text-decoration part off it

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.