PDA

View Full Version : Text Underline on hover



mikacruz
Jan 22nd, 2009, 10:45 AM
Hello All,
I dont know why the links dont underline when cursor passes over.
This is the HTML page (http://www.eulconsult.eu/mic/index_n.html)
I'm reffering to both link areas at lines 29 and 49 of the html,
The css defines

a:hover,a:active
{
text-decoration: underline;
}
line 27.
Thanks a lot for your help ;-)

rangana
Jan 22nd, 2009, 10:53 AM
Do it like this:


#submenu li a:hover,#submenu li a:active


Hope that helps.

mikacruz
Jan 22nd, 2009, 11:05 AM
Thanks bro ;-)

jerry62704
Jan 22nd, 2009, 04:27 PM
I use the forum to learn and I was confused by the answer. So I looked at the page to see why it worked and I'm posting this to 1) make sure I understand it and 2) help anyone else that uses this as a learning aid.

The problem was a:hover with underlining turned on was not turning on the underlining in the menus.

Here is the resulting (and working) code:


#submenu li a:hover, #submenu li a:active {style.css (line 26)
text-decoration:underline;
}
#submenu ul li a {style.css (line 144)
color:#FFFFFF;
display:inline;
padding:0 10px;
text-align:center;
text-decoration:none;
text-transform:lowercase;
}

I believe the generic "a:hover" didn't work because the other rule was more specific. The "a" under a specific id (submenu) took precedence over the generic one so no underline appeared. When the generic was made as specific (id submenu was added), then the rule overrode the other one as it appeared after it in the original css.

If I got that wrong, please correct me. If I got it right, it may solve a future problem for someone.