Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS BODY fails 1

Status
Not open for further replies.

LordGarfield

IS-IT--Management
Jul 31, 2003
112
0
0
BE
HI,

I created a stylesheet and everything works on the page except the style I defined for the body

BODY
{
SCROLLBAR-FACE-COLOR: #d8d8d8;
SCROLLBAR-HIGHLIGHT-COLOR: #d8d8d8;
SCROLLBAR-SHADOW-COLOR: #000000;
SCROLLBAR-ARROW-COLOR: #000000;
SCROLLBAR-TRACK-COLOR: #ffffff;
SCROLLBAR-DARKSHADOW-COLOR: #d8d8d8;
SCROLLBAR-BASE-COLOR: #d8d8d8;
BACKGROUND-COLOR: #d8d8d8;
}

this is my style for the body. Why is this failing?

maybe it is better to post the full style sheet so here we go

<STYLE>
BODY
{
SCROLLBAR-FACE-COLOR: #d8d8d8;
SCROLLBAR-HIGHLIGHT-COLOR: #d8d8d8;
SCROLLBAR-SHADOW-COLOR: #000000;
SCROLLBAR-ARROW-COLOR: #000000;
SCROLLBAR-TRACK-COLOR: #ffffff;
SCROLLBAR-DARKSHADOW-COLOR: #d8d8d8;
SCROLLBAR-BASE-COLOR: #d8d8d8;
BACKGROUND-COLOR: #d8d8d8;
}
TABLE
{
BORDER-RIGHT: 1px solid #000000;
BORDER-TOP: 1px solid #000000;
BORDER-LEFT: 1px solid #000000;
BORDER-BOTTOM: 1px solid #000000;
BORDER-SPACING: 0;
border-collapse: collapse;
}
TD
{
FONT-SIZE: 8pt;
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
BACKGROUND-COLOR: #d8d8d8;
PADDING: 0;
}
a:link
{
COLOR: blue;
}
a:visited
{
COLOR: purple;
}
a:hover
{
COLOR: red;
BACKGROUND: yellow;
}
a:active
{
COLOR: yellow;
BACKGROUND: red;
}
</STYLE>

The table styles and the link styles all work.

The style sheet is named
test.css and in my html files I call it between the
<head></head> tags

so
<head>
<link href=&quot;test.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;>
</head>

can anyone help me?

Greetings
Roel.
 

I'm not sure, but it's possible that some CSS properties are case-sensitive.

If all else fails, try making them lowercase, so:

SCROLLBAR-FACE-COLOR

would become

scrollbar-face-color

Hope this helps,

Dan
 
I don't think the case matters (though it sure looks weird in upper case...) but it's that erroneous <STYLE> tag that's doing it. The browser sees it as

<style> body { SCROLLBAR-FACE-COLOR: #d8d8d8; ... }

i.e. It tries to apply the rules to body tags that are inside <style> tags - or, more likely, rejects the whole rule as being invalid syntax. Either way, it doesn't get applied as expected.

-- Chris Hunt
 
When I have done inline styles, I have used the following syntax with success:
<style type=&quot;text/css&quot;> <!--
(styles)
--> </style>
 
chsarjea,

I have always found that using
Code:
<!-- ... -->
anywhere in CSS files causes huge rendering problems on a few browsers.

CSS comments, as far as I know, should only ever be of the
Code:
/* ... */
construct, and I don't even know if the
Code:
//
syntax is allowed, but maybe someone else will know more on this.

Hope this helps,

Dan

 
no they work fine -- i have been using that for inline for bout a year

never had rendering problems -- of course i only concern my self with the newest browsers.

Listen All I ask is that You close out a Post You Started!!!!
 
When you put your style declarations in the <head> of an HTML file, chsarjea's syntax works just fine. The <!-- ... --> tags aren't really a comment, but a way to hide the style declarations from some truly ancient browsers. They don't understand what CSS is, so they're likely to display the style definitions on the page the user sees. The &quot;comment&quot; tags ensure that the styles will be ignored instead. Since we're talking about version 3 browsers here - seriously dead - it may not be worth the trouble. CSS-understanding browsers (including NN4!) will read the style declarations despite these &quot;comment&quot; tags.

When you put your style declarations in a seperate file - as you should - including either the <style> or the <!-- ... --> tags will just confuse the browser and cause one or more of your rules not to work.

As Dan says, actual comments in the body of CSS declarations - wherever they are - should be enclosed in /* */ marks.

-- Chris Hunt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top