View Full Version : Linking to External Style Sheet


Opv
08-05-2006, 04:38 PM
Is there a way when linking to an external style sheet to call a specific style class? I want to use an external css sheet which defines three separate sets of styles for three different web pages so that I don't have to maintain the code in different places.

<link rel="stylesheet" type="text/css" href="filename.css" />

How would I change this to call a specific class within fillname.css?

Chris
08-05-2006, 05:25 PM
You can't do it that way.

You have to call the entire css file, and then refer to the class with the desired object

eg. <div class="header">...</div>

Opv
08-05-2006, 05:30 PM
Thanks.

Chris
08-05-2006, 07:22 PM
You're welcome :)

nevernoticed_93
08-14-2006, 12:42 AM
huh? i really don't get that...

Douglas
08-14-2006, 01:18 AM
Inside the .css file there would be something like this:

.className {
border:3px dotted #ff33cc;
}

And then on the page:

<div class="className">Text with dotted border</div>

Classes are defined with a . before them, and then there are ids:

#idName {
border:3px dotted #ffcc33;
}

Then in the html:

<div id="idName">Text with dotted border</div>

IDs are only supposed to be used once though.