15 replies [Last post]
samf
samf's picture
Offline
Enthusiast
Los Angeles, CA
Last seen: 10 years 1 week ago
Los Angeles, CA
Timezone: GMT-5
Joined: 2003-09-29
Posts: 106
Points: 34

I've never noticed this problem before, how can I fix this???

I have some links - want underline only on hover. So here's my style declaration:

#topSysOptions a{
color:#665;
}
#topSysOptions a:link{
text-decoration:none;
}
#topSysOptions a:hover{
text-decoration:underline; /** hover only on this **/
}
#topSysOptions a:active{
text-decoration:none;
}
#topSysOptions a:visited{
text-decoration:none;
}

The catch 22 which I've never noticed before is that, once a link is "visited", with this declaration it is no longer underlined on hover. However, if I take out the declaration for a:visited, it's underlined all the time.

Quite simply, I want links - visited, active, whatever - to underline when and only when I mouse over them. Is this possible?

Thank you

Life is complex -- don't make it complicated. If you need help with PHP visit PHP Builder

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 19 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

want "visited" links to still underline when hover

Read up on the correct order of anchor pseudo classes, which is vital and is 101 basic stuff, you can figure it out if you think about what's being asked by the pseudo states.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 1 year 13 weeks ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

Re: want "visited" links to still underline when h

samf wrote:
I want links - visited, active, whatever - to underline when and only when I mouse over them. Is this possible?

I do that all the time. All you need is two css rules:

a { text-decoration: none; }

a:hover {text decoration: underline; }

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 19 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

want "visited" links to still underline when hover

Ed the rules written already account for this, read what samf is asking and look closer at the rulesets.

Hugo.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 1 year 13 weeks ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

want "visited" links to still underline when hover

Hugo wrote:
Ed the rules written already account for this, read what samf is asking and look closer at the rulesets.

Well it just seemed to me that his ruleset for this effect was unnecessarily complicated and that the two rules I gave were all that's needed to do what he wants. But as my tagline says,

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 19 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

want "visited" links to still underline when hover

Your not wrong Ed, rather I was looking at the reason that it wasn't working as written.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

tripleshift
Offline
Enthusiast
Last seen: 15 years 42 weeks ago
Timezone: GMT+2
Joined: 2005-03-22
Posts: 70
Points: 0

want "visited" links to still underline when hover

Hugo wrote:
Your not wrong Ed, rather I was looking at the reason that it wasn't working as written.

well i guess its because once the link is visited and because the visited status is stated, it comes with no underline regardless of hover status.

as Ed wrote, there's no need to complicate and state the visited status since only the hover state needs underline.

am i missing something?

bye
tripleshift

...

I left my good sign in the other pants

larmyia
Offline
Elder
London
Last seen: 13 years 36 weeks ago
London
Timezone: GMT+1
Joined: 2005-01-25
Posts: 1060
Points: 0

want "visited" links to still underline when hover

tripleshift wrote:

am i missing something?

I think Hugo's point was that the links are in the wrong order and he was encouraging the OP to invesigate this further. Of course it would have been easier to just tell this to the OP but then isn't this forum about helping ppl become better not spoon-feeding them?

briski
briski's picture
Offline
Elder
London
Last seen: 9 years 49 weeks ago
London
Timezone: GMT+1
Joined: 2004-02-16
Posts: 1066
Points: 0

Re: want "visited" links to still underline when h

Ed Seedhouse wrote:
samf wrote:
I want links - visited, active, whatever - to underline when and only when I mouse over them. Is this possible?

I do that all the time. All you need is two css rules:

a { text-decoration: none; }

a:hover {text decoration: underline; }

Whilst you at it why not add a focus state for keyboard users?

a { text-decoration: none; }
a:focus, a:hover {text decoration: underline; }

But as Hugo said the order in the OP is wrong (if you assume say that each state had a different action, say colour, they would need to be changed to work) it's just that in this case all the other declarations are not needed.

tripleshift
Offline
Enthusiast
Last seen: 15 years 42 weeks ago
Timezone: GMT+2
Joined: 2005-03-22
Posts: 70
Points: 0

want "visited" links to still underline when hover

larmyia wrote:
...

I think Hugo's point was that the links are in the wrong order and he was encouraging the OP to invesigate this further. Of course it would have been easier to just tell this to the OP but then isn't this forum about helping ppl become better not spoon-feeding them?

oh well yes i know that, i meant if i was missing something from the original question so that my statement could be incorrect.

i totally agree on the spoon-feeding thing, i myself don't like this attitude, but since the love-hate thing was already stated by hugo i thought to go for more.

Wink

bye
tripleshift

...

I left my good sign in the other pants

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 19 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

want "visited" links to still underline when hover

tripleshift wrote:
larmyia wrote:
...

I think Hugo's point was that the links are in the wrong order and he was encouraging the OP to invesigate this further. Of course it would have been easier to just tell this to the OP but then isn't this forum about helping ppl become better not spoon-feeding them?

oh well yes i know that,

Then why did you feel the need to expand on things? it reads as though you're explaining to me what was wrong :?

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

tripleshift
Offline
Enthusiast
Last seen: 15 years 42 weeks ago
Timezone: GMT+2
Joined: 2005-03-22
Posts: 70
Points: 0

want "visited" links to still underline when hover

Hugo wrote:
...

Then why did you feel the need to expand on things? it reads as though you're explaining to me what was wrong :?

eh eh Laughing out loud
no, nothing like that! (me teaching you? Laughing out loud no way! Wink )
i just used your words to get in...

i wanted to point out, beside the order thing, why the code wasn't working.
i thought there was something missing, something that could be interesting and useful for samf...

my intention was to add something to the discussion while sustaining Ed's point, nothing more.

hope everything is clearer now Wink

bye
tripleshift

...

I left my good sign in the other pants

jlhaslip
Offline
Enthusiast
Last seen: 13 years 5 days ago
Timezone: GMT-6
Joined: 2006-02-02
Posts: 199
Points: 0

want "visited" links to still underline when hover

Lover = lvha
Link - Visited - Hover- Active
This is how I learned it.

I'm having a good day...so far.

Anonymous
Anonymous's picture
Guru

want "visited" links to still underline when hover

Link - Visited - Focus - Hover- Active

Just remember "LoVe For HAte".

Trying to remember if I have focus in the right place. :?:

briski
briski's picture
Offline
Elder
London
Last seen: 9 years 49 weeks ago
London
Timezone: GMT+1
Joined: 2004-02-16
Posts: 1066
Points: 0

want "visited" links to still underline when hover

You do.

Lord
Vader
Formely
Hatefull
Anakin

Is a nice geeky reminder.

What perplexes me most is how most people remember to put active in there but not focus :?

larmyia
Offline
Elder
London
Last seen: 13 years 36 weeks ago
London
Timezone: GMT+1
Joined: 2005-01-25
Posts: 1060
Points: 0

want "visited" links to still underline when hover

haha I've not heard that one before. I like it Wink