a:hover and a:link help

liunx

Guest
Dr. Web was kind enough to let me copy this off his web page:<br />
<br />
<STYLE><br />
A:link, A:active{ color:#0000FF; text-decoration:none; font-family: georgia; font-weight: bold; font-size: 12pt; }<br />
A:hover, A:visited{ color:#e01c02; text-decoration:none; font-family: georgia; font-weight: bold; font-size: 12pt; }<br />
</STYLE><br />
<br />
and I've figured out pretty good how to modify this for my liking. My question is, this script, like it is, affects the whole page, how can I set this so that one cell on my page has one style of links, say no underline, and another cell the links underline while hovered?<br />
<br />
Again, I know how to adjust the script for one or the other on the whole page, but not 2 different styles on the same page.<!--content-->i had a similar problem earlier this summer. actually some of the scripts like this can not run parallel. the only way i know of is to have seperate frames, or iframes. via ssi doesnt work, and when added to a cgi, then added virtually, it didnt work for me.<br />
<br />
doc will likely have a loop hole to prove me wrong again! come on doc! do it! you know you want to!:D<br />
chris<pixelmonkey>:monkey:<!--content-->Doc won't have to prove you wrong.<br />
<br />
here's a quick sample page:<br />
<br />
<html><head><br />
<script><br />
a.menu {color:#0000ff; style:underline;}<br />
a.menu:hover {color:#000000; style:none;}<br />
<br />
a.hello {color:#ff0000; style:none;}<br />
<br />
</script></head><br />
<body><br />
<a href=http://www.htmlforums.com/archive/index.php/"hello.html" class="hello">Hello</a><br />
<a href=http://www.htmlforums.com/archive/index.php/"menu.html" class="menu">Menu Option</a><br />
</body></html><br />
<br />
ok, this isn't very practical, but that's how it's done.<!--content-->I'm kinda following you but I'm not great with strait html. I copied as is in a text doc and saved as an html and got an error line 4 expected ";".<br />
<br />
I'm assuming the referance is between the 2 are a.menu and class="menu" ?<!--content-->sorry about that. You are correct in your assumption.<!--content-->Ok, this is what I tried knowing what little I know:<br />
<br />
<html><br />
<head> <br />
<SCRIPT><br />
A.menu:link{ color:#999999; text-decoration:underline; font-family: georgia; font-weight: bold; font-size: 12pt; } <br />
A.hello:link{ color:#0000FF; text-decoration:none; font-family: georgia; font-weight: bold; font-size: 12pt; } <br />
</SCRIPT><br />
</head> <br />
<body> <br />
<a href=http://www.htmlforums.com/archive/index.php/"hello.html" class="hello">Hello</a> <br />
<a href=http://www.htmlforums.com/archive/index.php/"menu.html" class="menu">Menu Option</a> <br />
</body><br />
</html> <br />
<br />
and still get expect ";" on line 5 now??<!--content-->My bad. I accidently used <script> tags instead of <style> tags. Sorry about that. That'll fix your problems.<!--content-->as BloodGHST already mentioned, using classes in CSS will help you to do this. I also had an example page written to show you how to change colors/ text-decoration (underline) for different links.<br />
<br />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><br />
<br />
<html><br />
<head><br />
<title>Untitled</title><br />
<style><br />
a.swiss:link {color: red; text-decoration: none;}<br />
a.swiss:visited{color: red; text-decoration: none;}<br />
a.swiss:active{color: red; text-decoration: none;}<br />
a.swiss:hover {color: yellow; text-decoration: none;}<br />
<br />
a.cheese:link {color: blue; text-decoration: none;}<br />
a.cheese:visited{color: blue; text-decoration: none;}<br />
a.cheese:active{color: blue; text-decoration: none;}<br />
a.cheese:hover {color: #cccccc; text-decoration: none;}<br />
<br />
a.wow:link {color: black; text-decoration: underline;}<br />
a.wow:visited{color: black; text-decoration: underline;}<br />
a.wow:active{color: black; text-decoration: underline;}<br />
a.wow:hover{color: blue; text-decoration: underline;}<br />
</STYLE> <br />
<br />
<br />
</style><br />
</head><br />
<br />
<body><br />
<br />
<a href=http://www.htmlforums.com/archive/index.php/"zonk.html" class="swiss">swiss</a>&nbsp;&nbsp;&nbsp;<br />
<a href=http://www.htmlforums.com/archive/index.php/"zonk.html" class="cheese">cheese</a>&nbsp;&nbsp;&nbsp;<br />
<a href=http://www.htmlforums.com/archive/index.php/"zonk.html" class="wow">w o w</A><br />
<br />
</body><br />
</html><!--content-->That's got me going, Thanks for all of ya'lls help. This has been one of the best forums I've ever been on!<!--content-->If you are going to have the links in groups you can save a lot of work by using scoped like this (using the doctor's swiss class):<br />
<br />
<style> <br />
.swiss a:link {color: red; text-decoration: none;} <br />
.swiss a:visited{color: red; text-decoration: none;} <br />
.swiss a:active{color: red; text-decoration: none;} <br />
.swiss a:hover {color: yellow; text-decoration: none;} <br />
a.cheese:link {color: blue; text-decoration: none;} <br />
a.cheese:visited{color: blue; text-decoration: none;} <br />
a.cheese:active{color: blue; text-decoration: none;} <br />
a.cheese:hover {color: #cccccc; text-decoration: none;} <br />
</STYLE> <br />
<br />
<br />
Now it you do this:<br />
<br />
<span class="swiss"><br />
<br />
<a href=http://www.htmlforums.com/archive/index.php/"somelink">blah </a><br />
<a href=http://www.htmlforums.com/archive/index.php/"anotherlink">blahblah</a><br />
<a href=http://www.htmlforums.com/archive/index.php/"cheeselink" class="cheese">cheese</a><br />
</span><br />
<br />
The first two links will be swiss but he third will be cheese The scoped format of .class tag specifies whenever this tag is inside of a container of this class appy the style. the format tag.class specifies apply the style when this tags has this class and has precidence of scoped classes. That's the cascading part of CSS.<!--content-->I should add one caution. Forget the cascade with the TD tag the inheritance to totally screwed up in every browser.<!--content-->That's cool, so I can <SPAN> my page into chunks without having to add "class=" into every "href" that I do.<!--content-->
 
Back
Top