PDA

View Full Version : Newbie CSS question


Geoff G
11-21-2002, 08:00 PM
Hi, guys. I'm new at this, so be gentle.

I'd like to know why only some of my CSS formatting works in Netscape (both 4.7 and 7.0)--it works properly in IE.

Here's the problem CSS code, in its entirety:


BODY {background: "#00CC33"}
H1 {font-size: 40pt; color: "#663399"; font-family: "cataneo bt"}
p, tr {font-size: 20pt; color: "#663399"; font-family: "cataneo bt"}

.leg {font-size: 26pt; color: "red"; font-family: "copprplgoth bd bt"}

A:link {color: "#663399"; text-decoration: none }
a:active {color: "#00ff00"; text-decoration: none }
a:visited {color: "#663399"; text-decoration: none }


Specifically, the problem is that colours (background, font) are not recognized. The span colour works, but none of the hex colours (well, the A:link colours work, but incorrectly--the visited links are different from the non-visited, and the active links don't change at all).

Any insight would be appreciated...

Thanks, Geoff.

DCElliott
11-21-2002, 08:17 PM
First, lose the quotes. The CSS spec calls for single quotes to bind terms with spaces only like {font-face:'ms sans-serif';} and not elsewhere unless you are using the content property (but that is another story). You have put quotes on your hex color values as if they were tag attributes. that is breaking your CSS. Different browsers have different tolerance for bad code. One will "permit" it and the other will igonore it as it is supposed to.

It isn't hurting your code, but you should generally terminate your last property with a semicolon ';' as well.

DCElliott
11-21-2002, 08:23 PM
Oh, and one other tip. All your color codes are based on the "safe" palette with values like #663399 and #00CC33. When all the numbers are doubled, you can short hand with single numbers: #639 = #663399 or #0C3 = #00CC33. It looks cool and people who don't know the trick wonder how you are making it work.
:weee:

Geoff G
11-22-2002, 08:32 AM
I appreciate your help.

ByteWizard
11-22-2002, 09:17 AM
Is #ABC a viable substitute for #0A0B0C ?

Zero Angel
11-22-2002, 09:53 AM
No, but it is a substitute for #AABBCC.