Click to See Complete Forum and Search --> : Using classes in CSS


ToYourEscape
02-18-2004, 05:08 PM
I need to know how to make classes for the CSS on my page in reagrds to the links. On the menu of my page I want the following CSS to apply to the links:

<STYLE type="text/css">
A { color:#000000; text-decoration:none; }
A:visited { color:#000000; text-decoration:none }
A:hover { color:#FFFFFF; text-decoration:none; }
A:active { color:#000000; text-decoration:none}
</STYLE>

However, within the content area of my page, I want the following CSS to apply to the links within the content area only and not affect the menu links:

<style type="text/css"><!--
A { color:#1e1e1e; text-decoration:underline; }
A:visited { color:#1e1e1e; text-decoration:underline }
A:hover { color:#FFFFFF; text-decoration:none; }
A:active { color:#1e1e1e; text-decoration:underline}
--></STYLE>

I know there is a way to do this with the use of classes but I dont know the code or naything for this sort of thing.

Thanks,
Dave

Sam
02-18-2004, 05:29 PM
i would do this using id's ie.
<head>
<style type="text/css">
#content a{color:#1e1e1e; text-decoration:underline;}
#content a:visited{color:#1e1e1e; text-decoration:underline;}
etc.
</style>
</head>

<body>
<div id="content">
<a href="blah">Blah</a>
</div>
</body>

this way, those styles only apply to <a>'s within content

Paul Jr
02-18-2004, 07:11 PM
Yeah, I'd go with what samij suggested. It's easier than assigning multiple links a class. Saves on typing and such. ;)