Jump to content

How to aply a:hover on a links with varied styles


gauravc7
 Share

Recommended Posts

I have a table of contents and a index page.the toc, contains heading, sub heading, chapter heading, etc. all are links to the anchor or a page.i want to apply a:link without underlie, a:hover with underline & a:visited same as a:linkhow can i do it.can css be nested . eg. if i had made some style can i use it to define some selectrslike .cstm {font-family:arial}can iuse it to define a:hover???

Link to comment
Share on other sites

a.classname:hover (classname = then name of the class)does not works.cstm{font-family:arial;text-decoration:none;color;red}a.cstm:hover{classname=cstm} or a.cstm:hover{classname=.cstm}a.cstm:hover(classname=.cstm) or a.cstm:hover(classname=cstm)does not workany other method or i may be wrong??

Link to comment
Share on other sites

This is how it should look.a:link applies to all anchor tagsa.one:hover applies to anchors with class one but also inherits a:link style

<html><head><style type="text/css">a:link {color: #ff0000; text-decoration: none}a:visited {color: #0000ff; text-decoration: none}a:hover {text-decoration: underline}a.one:hover {background: #66ff66}a.two:hover {font-size: 150%}</style></head><body><a class="one" href="#">This link changes bgcolor</a><br /><a class="two" href="#">This link changes size</a>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...