I've just recently started with CSS and when I put the code in the page all is
well. However when I try to use an external /css file it won't work :~(
Could some kind person please shed some light on this before I go completely
crazy?
Here's the .css file (for a coloured scroll bar):
{ scrollbar-base-color:#999999; scrollbar-face-color:#cccccc;
scrollbar-shadow-color:E15A00;
scrollbar-highlight-color:999999; scrollbar-3dlight-color:E15A00;
scrollbar-darkshadow-color:cccccc;
scrollbar-track-color:#green; scrollbar-arrow-color:#E15A00; }
And here's the code in the page:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel=stylesheet href="testCSS.css" type="text/css">
<font color="#0000FF">test CSS
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</font>
</body>
</html>
TIA Jenny
> I've just recently started with CSS and when I put the code in the page all is
> well. However when I try to use an external /css file it won't work :~(
>
> { scrollbar-base-color:#999999; scrollbar-face-color:#cccccc;
> scrollbar-shadow-color:E15A00;
> scrollbar-highlight-color:999999; scrollbar-3dlight-color:E15A00;
> scrollbar-darkshadow-color:cccccc;
> scrollbar-track-color:#green; scrollbar-arrow-color:#E15A00; }
<snip>
If the style works in your page you probably forgot to copy it
correctly, everything between the <style> ... </style> tags has to go
into the external stylesheet. e.g. body {...}.
Also, your colors don't all begin with a pound symbol: #
http://www.htmlhelp.com/reference/css/units.html#color
body {
scrollbar-base-color: #999999;
scrollbar-face-color: #cccccc;
scrollbar-shadow-color: #E15A00;
scrollbar-highlight-color: #999999;
scrollbar-3dlight-color: #E15A00;
scrollbar-darkshadow-color: #cccccc;
scrollbar-track-color: #green;
scrollbar-arrow-color: #E15A00;
}
I'm not sure if this matters but I always put "stylesheet" in quotes:
<link rel="stylesheet" href="testCSS.css" type="text/css">
And the testCSS.css file has to be in the same folder as the pages that
refer to it, since you didn't include any path before the filename.
Mike
Don't think so Mike. the above is exactly what i have in the .css
file..................
> Also, your colors don't all begin with a pound symbol: #
> http://www.htmlhelp.com/reference/css/units.html#color
>
> body {
> scrollbar-base-color: #999999;
> scrollbar-face-color: #cccccc;
> scrollbar-shadow-color: #E15A00;
> scrollbar-highlight-color: #999999;
> scrollbar-3dlight-color: #E15A00;
> scrollbar-darkshadow-color: #cccccc;
> scrollbar-track-color: #green;
> scrollbar-arrow-color: #E15A00;
> }
>
> I'm not sure if this matters but I always put "stylesheet" in quotes:
> <link rel="stylesheet" href="testCSS.css" type="text/css">
Doesn't seem to make any difference !! To my surprise it works with or without
the #
> And the testCSS.css file has to be in the same folder as the pages that
> refer to it, since you didn't include any path before the filename.
> Mike
All files are in the same directory.
I was wondering whether it has to do with the fact that the css is used in a
inline frame. Should I perhaps put the 'get css file' command in the main page
or the inline frame page ??
test page at: http://members.rott.chello.nl/ldejager2/KSPD2004WGW/index.htm
Jenny
I think a good place to start is making sure your CSS and HTML are
valid. Here are a couple of pages you can use to do that:
======================================================================
Validate your CSS using this page:
http://jigsaw.w3.org/css-validator/
W3C CSS Validator Results for
http://members.rott.chello.nl/ldejager2/KSPD2004WGW/index.htm
To work as intended, your CSS style sheet needs a correct document parse
tree. This means you should use valid HTML.
Errors
URI : http://members.rott.chello.nl/ldejager2/KSPD2004WGW/index.htm
* Line: 22
Parse error - Unrecognized : {margin: 0; overflow:auto;}
======================================================================
Validate your HTML using this page:
http://www.htmlhelp.com/tools/validator/
http://www.htmlhelp.com/cgi-bin/validate.cgi?url=http%3A%2F%2Fmembers.rott.chello.nl%2Fldejager2%2FKSPD2004WGW%2Findex.htm&warnings=yes
> I was wondering whether it has to do with the fact that the css is used in a
> inline frame. Should I perhaps put the 'get css file' command in the main page
> or the inline frame page ??
Google for examples of formatting iframes with css, e.g.
http://forums.devshed.com/archive/t-39797
MIke
Thanks for the URLs Mike.
The reason it was not working was that I'd put the link to the css file in the
body and not the header !
That's what you get by being an auto didactic :~)
Thanks for your comments. Jenny