PDA

View Full Version : Setting A:Link, A:Hover etc. in HTML FONT TAG?


Quiz
11-17-2003, 11:27 PM
I have tried to set a link, hover, alink style properties in a FONT STYLE="...." tag for a specific link to override the file.css for the page. It doesn't seem to work. The format is "a:link{}", I don't know how to code this in next to "font-family:sans-serif;" and the rest.

Can this be done? I'd appreciate any help, thanks.

lavalamp
11-17-2003, 11:30 PM
The answer is simple, don't do that (because you can't, if it does work then it's one messed up browser).
Simply give the links you want to be different from the styles a class or a unique id and put that in the styles. It's so much simpler, easier and more correct.

Quiz
11-17-2003, 11:39 PM
Thanks lavalamp.

But can you nest a a:link{...} inside a #id{} or .class{}? Because the file.css already has a a:link{} etc. for all elements universally.

lavalamp
11-17-2003, 11:44 PM
Theoretically you can do this:

a.boo:link{rules...}


But IE tends to fall flat on it's face, so what I do is this:

span.boo a:link{rules...}

You don't even need the span unless you want to be really specific:

.boo a:link{rules...}


I usually am being ultra specific so that I don't have any accidental knock-on effects for other elements on my site.


In case you were wondering how you should alter your links, just do this:

<span class="boo"><a href="#">BOO!!!</a></span>

Quiz
11-18-2003, 12:18 AM
Thank you.

It works.

lavalamp
11-18-2003, 10:21 AM
Happy to help. :)