joshuadavidlee
asked on
How do make subclasses of anchor tags in CSS file?
if i use a:hover I can make ALL my rolled over hyperlinks look however I want, but I have several different hyperlinks that I want to look different. Can I make sub classes of a in my css files?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
a:link {
font-family: Tahoma;
font-size: 12px;
font-weight: normal;
color: #990000;
text-decoration: none;
}
a:visited {
font-family: Tahoma;
font-size: 12px;
font-weight: normal;
color: #990000;
text-decoration: none;
}
a:hover {
font-family: Tahoma;
font-size: 12px;
font-weight: normal;
color: #990000;
text-decoration: underline;
}
a.second:link {
font-family: Tahoma;
font-size: 12px;
font-weight: bold;
color: #0000FF;
text-decoration: none;
}
a.second:visited {
font-family: Tahoma;
font-size: 12px;
font-weight: bold;
color: #0000FF;
text-decoration: none;
}
a.second:hover {
font-family: Tahoma;
font-size: 12px;
font-weight: bold;
color: #0000FF;
text-decoration: underline;
}
-->
</style>
</head>
<body>
<p><a href="http://www.google.com">Google</a></p>
<p><a href="http://www.yahoo.com" class="second">Yahoo</a></ p>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
a:link {
font-family: Tahoma;
font-size: 12px;
font-weight: normal;
color: #990000;
text-decoration: none;
}
a:visited {
font-family: Tahoma;
font-size: 12px;
font-weight: normal;
color: #990000;
text-decoration: none;
}
a:hover {
font-family: Tahoma;
font-size: 12px;
font-weight: normal;
color: #990000;
text-decoration: underline;
}
a.second:link {
font-family: Tahoma;
font-size: 12px;
font-weight: bold;
color: #0000FF;
text-decoration: none;
}
a.second:visited {
font-family: Tahoma;
font-size: 12px;
font-weight: bold;
color: #0000FF;
text-decoration: none;
}
a.second:hover {
font-family: Tahoma;
font-size: 12px;
font-weight: bold;
color: #0000FF;
text-decoration: underline;
}
-->
</style>
</head>
<body>
<p><a href="http://www.google.com">Google</a></p>
<p><a href="http://www.yahoo.com" class="second">Yahoo</a></
</body>
</html>
for instance:
<a class="redlink" href="">link</a>
css:
a.redlink {color:red;}
a.redlink:hover {color:pink}
OR
if the links that you want to change are on a certain area of the page, you can use a descdendancy selector:
<div id="leftsection">
<a href="">link</a>
</div>
css:
div#leftsection a {color:red}
div#leftsection a:hover {color:pink}
Steggs
Cheers
Steggs