Log in

View Full Version : CSS Error



Diversions
07-24-2008, 02:39 PM
So I am finally migrating from MS Front Page to real php and css websites with the help of W3C schools and this forum.
I have just done up one site without FrontPage and admit that it is nowhere near as difficult as I thought (although I only did some basic stuff)
Problem is I am getting a CSS notice through Firefox whether I run internally through the WAMP server or online. The following is the error:

CSS ERROR; expected ":" but found 'size' Declaration Dropped

Now I have gone through W3C and this forum to find out what this might be and have checked stylesheet.css and have drawn a blank in spite of the fact the stylesheet I am sure is extremely simple.

If anyone has any suggestions they would be gratefully accepted. I have included the entire stylesheet below. There is nothing above or below what you see. Apart from the error above, everything seems to work fine on the live site.


CSS:

h1 {
font-family: Tahoma; sans serif;
font-size: 150%;
color: #FF0000
}

h2 {font-family: Tahoma; sans serif;
color: red;
font-size: 110%;
background-color: yellow
}

p {
font-family: Tahoma; sans serif;
font-size: 90%
}

span {
color: #FFFF00
}


td {
font-family: Tahoma; sans serif;
font-size: 90%
}

th {
font-family: Tahoma; sans serif;
color: #FF0000;
background-color: yellow;
font size: 100%
}

Thanks for your help.
D

jscheuer1
07-24-2008, 02:44 PM
This:



th {
font-family: Tahoma; sans serif;
color: #FF0000;
background-color: yellow;
font size: 100%
}

should be:


th {
font-family: Tahoma; sans serif;
color: #FF0000;
background-color: yellow;
font-size: 100%;
}

Diversions
07-24-2008, 02:59 PM
Clearly I have to learn to be more attentive to the little details. One additional thing. After I made the corrections it was finding fault with the line:

font-family: Tahoma; sans serif;

when I deleted the "sans serif;" I now show no errors in CSS.
Is there a problem if I just leave sans serif off or could I run into a problem with some visitors not seeing any text if they do not have Tahoma installed in their fonts?

Thank you
D

Medyman
07-24-2008, 04:06 PM
The list should be separated by commas, not semicolons. So change it to:


font-family: Tahoma, sans serif;

If you don't specify a font family, the browser will use whatever the default system font is. Same thing if the user doesn't have that particular font installed. So, you don't have to worry about your text not showing up. It's just a matter of what font is used.

jscheuer1
07-24-2008, 05:12 PM
That's actually (with a dash):


font-family: Tahoma, sans-serif;

And it is prudent, though not yet required (some day maybe) and won't hurt now, Tahoma could better be tahoma (lower case).

And as a side note, if the family property really is more than one word, it should be quoted, ex:


font-family : 'times new roman', serif;

Diversions
07-24-2008, 06:53 PM
Clearly I have much yet to learn but I really appreciate your guidance and now there does not seem to be any further CSS warnings.
I do appear to have a problem with the img now but I will attempt to work through that myself. It adheres to a calcified brain easier when one has to work for it! :)

Cheers all and as always, excellent advice.

D