Powered by:
FutureQuest Hosting


"...Remember being a youngster, mom or dad telling you "close the door"? Well the same applies to HTML ...."

Web Hosting
Shared       
Reseller     
VPS             
Dedicated 
Price:   $(US)
Space:     (MB)
Transfer:(GB)
Platform:


Advertise
Advertising Opportunities
Rate Card

Sponsor
Go Back   Webmaster Forums > Code Forum > CSS Forum


Reply
 
Thread Tools Rate this Webmaster Discussion
  #1  
Old 04-24-2009, 01:43 PM
ataxia1 ataxia1 is offline
Junior Member
 
Join Date: Apr 2009
Webmaster Discussions: 2
Rep Power: 4
ataxia1 is on a distinguished road
Question Exclude one hyperlink from a:hover style

I have an external style sheet which formats my entire site. Part of that sheet removes underlines, except on hover, from hyperlinks. On one particular page, however, I would like to override that part of the style for links within a certain class of cell. Nothing I've tried has worked, but here are a couple excerpts from my most recent attempt.

EXTERNAL CSS FILE:
a:link {text-decoration: none; color: #223F7A;}
a:visited {text-decoration: none; color: #223F7A;}
a:hover {text-decoration: underline; color: #223F7A;}

HTML FILE:
<head>
<style type="text/css">
.MyClass {lots of cell formatting CSS here}
a.MyClass:hover {text-decoration: none;}
</style>
</head>
<body>
<td class="MyClass">
<a href="">No underline on hover here</a>
</td>
<td class="AnotherClass">
<a href="">DO underline this link on hover</a>
</td>
</body>

Thanks,

- Brad


Reply With Quote
  #2  
Old 04-24-2009, 04:05 PM
jthayne's Avatar
jthayne jthayne is offline
Senior Member
 
Join Date: Aug 2008
Location: Texas
Webmaster Discussions: 487
Rep Power: 15
jthayne is the hardest working person in the biz. jthayne is the hardest working person in the biz. jthayne is the hardest working person in the biz. jthayne is the hardest working person in the biz.
Re: Exclude one hyperlink from a:hover style

Quote:
Originally Posted by ataxia1 View Post
EXTERNAL CSS FILE:
Code:
a:link {text-decoration: none; color: #223F7A;}
a:visited {text-decoration: none; color: #223F7A;}
a:hover {text-decoration: underline; color: #223F7A;}
HTML FILE:
HTML Code:
<head>
    <style type="text/css">
        .MyClass {lots of cell formatting CSS here}
        a.MyClass:hover {text-decoration: none;}
    </style>
</head>
<body>
    <td class="MyClass">
       <a href="">No underline on hover here</a>
    </td>
    <td class="AnotherClass">
       <a href="">DO underline this link on hover</a>
    </td>
</body>
You are referencing the class wrong. In the HTML, you are applying the class to the table cell, and in the CSS you are referencing it as though you had applied the class to the anchor tag.

Change your CSS as follows:

HTML Code:
    <style type="text/css">
        .MyClass {lots of cell formatting CSS here}
        .MyClass a:hover {text-decoration: none;}
    </style>
That should resolve the issue.
__________________
Be sure to click the reputation icon to give rep to the person who helped you.
Check out the following sites: www.inbutnotoftheworld.com and www.mythoughtexactly.com.
Reply With Quote
  #3  
Old 04-26-2009, 08:44 PM
ataxia1 ataxia1 is offline
Junior Member
 
Join Date: Apr 2009
Webmaster Discussions: 2
Rep Power: 4
ataxia1 is on a distinguished road
Re: Exclude one hyperlink from a:hover style

Worked perfectly.

Thanks!
Reply With Quote
  #4  
Old 06-23-2009, 08:33 AM
wcipolli wcipolli is offline
Member
 
Join Date: Jun 2009
Webmaster Discussions: 28
Rep Power: 3
wcipolli is on a distinguished road
Re: Exclude one hyperlink from a:hover style

sorry

Last edited by wcipolli; 06-23-2009 at 08:36 AM. Reason: wrong thread
Reply With Quote
Reply
Sponsor

Bookmarks

Tags
ahover , exclude , hyperlink , style

Thread Tools
Rate This Thread
Rate This Thread:

 

Similar Webmaster Discussions
Thread Webmaster Discussion Starter Forum Replies Last Post
can't get a:hover to work in IE6 herbie04 CSS Forum 2 05-25-2007 05:13 AM
Hover command on a td hbass CSS Forum 3 01-19-2006 06:04 PM
CSS Print (exclude menu) HELP aideenm CSS Forum 4 07-14-2004 08:14 AM
Help with an inline a:hover wconti CSS Forum 1 03-12-2003 11:28 PM
Hover text Tuk Website Scripts Forum 1 06-03-2002 06:34 AM


All times are GMT -5. The time now is 05:20 PM.

Copyright © 1999 - 2009 Advanced HTML For Beginners and AHFB2000. All rights reserved.
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.