View Full Version : css only works "part-time"

Feb 23rd, 2003, 05:07 PM
Hi, I'm using a css file for my homepage. However, only some of my attributes work. Example:

p: {font-family:"Arial"; font-size:20pt; font-color:#ff0000;}

the first one works, the rest doesn't. The same goes for some <a> and <body> attributes. I tried different ways of spelling like
font-size: 20pt
but I just can't get it to work properly. I looked it up in some books but I couldn't find anything.

Has anyone experienced this problem before? Can anyone suggest a solution?

Thanks a lot!

Feb 23rd, 2003, 05:13 PM
Be sure to end with semicolons.

font-size: 20pt;

Feb 23rd, 2003, 05:25 PM
herm... try this:

p {
font-family: arial;
font-size: 20pt;

notice that is color, not font-color... does that work now?

Feb 23rd, 2003, 06:04 PM
@eddy: that's what I thought, too, but semicolons don't really matter (at the end of the line)

@redhead: no, that didnt work either

Feb 23rd, 2003, 06:11 PM
well... it does for me.

can you post a little more code so someone can see exactly where you are going wrong, because whats been said should have sorted it

Feb 23rd, 2003, 06:18 PM
Thanks a lot for all your help, but actually, I just found the problem:

p: {font-family:"Arial"; color:#ff0000; font-size:2pt} // was the code I used
p {font-family:"Arial"; color:#ff0000; font-size:2pt} // would have been the correct code

I guess I just copied this line "a:hover {font-family:"Tahoma"; color:#00CC00; text-decoration:none;}" and thought the ":" was necessary.

... or to quote a well-known yellow guy: "Doh!"

Feb 23rd, 2003, 06:41 PM
heh... thats ok, good to see you got it sorted...

Feb 24th, 2003, 10:25 AM
If I may add one thing to that, well, actually two: it's not necessary to enclose a font name in quotes when it's a single word (it does if it's more than one word), and it's good practice to at least add a generic font name, such as serif or sans-serif in case the font specified is not available on the user's computer.