Log in

View Full Version : Having one CSS for several HTMLs



Haisook
09-24-2005, 04:08 PM
I need to make one CSS with all the properties (text, size, color, scrollbar) for all my HTMLs, so that I won't need to edit each page If I think of changing the layout. This way I'd need to edit only that CSS.

This is the layout properties:

<style type="text/css">
<!--
td {
font-family: arial;
font-size: 8pt;
color: #000000;
letter-spacing: 1px;
line-height: 150%;
}
a:link {
color: #008000;
text-decoration: none;
font-size:8pt;
}
a:visited {
color : #666666;
text-decoration : none;
font-size:8pt;

}
a:hover {
text-decoration: underline;
font-size: 8pt;
}
BODY {
SCROLLBAR-FACE-COLOR: #ffffff;
SCROLLBAR-HIGHLIGHT-COLOR: #cccccc;
SCROLLBAR-SHADOW-COLOR: #cccccc;
SCROLLBAR-3DLIGHT-COLOR: #ffffff;
SCROLLBAR-ARROW-COLOR: #008000;
SCROLLBAR-TRACK-COLOR: #ffffff;
SCROLLBAR-DARKSHADOW-COLOR: #ffffff;
}
-->
</style>

jscheuer1
09-24-2005, 04:24 PM
For that, you need to make up an external file (a text editor is fine for this), lets call it 'main.css'. It can have any name but the extension should be '.css'. Then put your declarations in there without the opening and closing style and comment tags, in other words remove:

<style type="text/css">
<!--and:

-->
</style>Then on each page you want the styles to apply, put this in the head:

<link rel="stylesheet" href="main.css" type="text/css" />Make sure the href points to the actual name and location of your external file relative to each page this statement is on. The above statement is fine for an external file named 'main.css' in the same directory as the page(s) that are using it.

Haisook
09-24-2005, 05:57 PM
Oh.. you rock jscheuer1..!
Thanks a lot and keep up!

Haisook
09-24-2005, 06:04 PM
(!)
I've just tried that but it's not working! What's wrong?!

Here is the code:

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Main Content</title>
<base target="_self">
<link rel="stylesheet" href="main.css" type="text/css" />
</head>

I've made a CSS file in the same directory with the name "main.css", here is what's in it:

td{
font-family: arial;
font-size: 8pt;
color: #000000;
letter-spacing: 1px;
line-height: 150%;
}
a:link {
color: #008000;
text-decoration: none;
font-size:8pt;
}
a:visited {
color : #666666;
text-decoration : none;
font-size:8pt;

}
a:hover {
text-decoration: underline;
font-size: 8pt;
}
BODY {
SCROLLBAR-FACE-COLOR: #ffffff;
SCROLLBAR-HIGHLIGHT-COLOR: #cccccc;
SCROLLBAR-SHADOW-COLOR: #cccccc;
SCROLLBAR-3DLIGHT-COLOR: #ffffff;
SCROLLBAR-ARROW-COLOR: #008000;
SCROLLBAR-TRACK-COLOR: #ffffff;
SCROLLBAR-DARKSHADOW-COLOR: #ffffff;
}

jscheuer1
09-24-2005, 10:07 PM
If all is as you say it is and I haven't missed any errors in the contents of main.css, then it is truly a mystery. There could always be something that you are not mentioning. Did you try refreshing the page a few times? Do any of the styles work? Is your page xhtml? Best to put up a demo on the web for me to check out:

.

Haisook
09-25-2005, 09:55 AM
Sorry, it worked.
It seems I just renamed the file to .css instead of actually turning it into a CSS format using Frontpage.

Sorry for confusing you
and thanks again

jscheuer1
09-25-2005, 04:44 PM
That isn't really necessary but, with Frontpage, nothing of that nature would surprise me. I do virtually all of my web coding with a text editor and have never needed to 'turn a file into' anything by any means other than coding it properly and naming it properly - Java (not to be confused with javascript) and Flash, which need to be compiled, and images excepted.

Glad it is working for you!