PDA

View Full Version : Including CSS link colors within external style sheet?


surfpark
11-05-2007, 10:28 PM
I'm writing to ask if its possible to have CSS links made multiple link colors within an external style sheet. For example, right now I want to use the class 'main

.bodytext {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-color: white;
font-size:12px;
margin-right: 20px;
margin-left: 20px;
color: #FFFFFF;
}
Is there a proper syntax that I can add to this style to make any links within this class show up a specific color? So far I'm only finding pseudo classes that need to be placed on each individual page. For example:
<style type="text/css">
.bodytext a:link { color: #ffff33; }
</style>

Ideally I want to have something like this:
.bodytext {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-color: white;
font-size:12px;
margin-right: 20px;
margin-left: 20px;
color: #FFFFFF;
a:link {color: #ffff33} (I know this is wrong syntax)
}

Any ideas as to how I can assign a link color to a class? My plans are to have several sections of the page with different link colors, but have them all within the the same style sheet. Is this possible?

Blue_Jeans
11-05-2007, 11:13 PM
In a css file, if you declare an element, such as a div, then you can target anything inside of it like so:
div targeted element {
//style it here
}
So in your case, mate:
.bodytext a:link {
color: #ff3;
}

I think you thought that you could only do this on individual pages. You can do it in an external stylesheet, mate.