CSS Validation

druagord's picture

He has: 335 posts

Joined: May 2003

hello for my personnal satisfaction i decided to validate the intranet i am building. I got everything under control and the message tells me that everything is ok but i get this warning when validating my css

Quote:
Line : 0 font-family: You are encouraged to offer a generic family as a last alternative

my style sheet first few lines are here

body 
{
color: black;
font-family: arial;
background-color: white;
}
'

is this caused by the fact i only set one font in the font-family.Sorry but i cannot post any url because this intranet contains sensitive information.

IF , ELSE , WHILE isn't that what life is all about

Busy's picture

He has: 6,151 posts

Joined: May 2001

font family is sans-serif or serif, just add it after the font name, in this case sans-serif so you end up with font-family: arial,sans-serif;
there is a whole family arial, verdana, and some others I can't spell without coffee Laughing out loud that you can use but to me its pointless as if the browser cant find the first font it will try the second .... (same as font tag) but just using one font family name (common one) and the family type its the same thing as the browser will pick a font from that family if it can't find the first one
*ok I'm babbling, really need that coffee now*

druagord's picture

He has: 335 posts

Joined: May 2003

so if i understand well, i might need another coffee too Smiling, there are font types and font familys (thats new to me). is there any standard about this.
if use sans-serif are the fonts of that family the same in any OS/browser ?

This might look dumb but i'm used to make layout using black time new romans font on a white background and when i want to be fancy i put a border on my tables:) . but now i'm stuck since the graphist i usualy work with is on vacation.

IF , ELSE , WHILE isn't that what life is all about

Busy's picture

He has: 6,151 posts

Joined: May 2001

still haven't finished my coffee so hopefully this doesn;t confuse you

arial (for example) is a font (type) it belongs to the sans-serif (family)
times new roman is a font (type) that belongs to the serif family

sans-serif is display fonts, while serif is print font (kinda thing)
I'm sure one of the others will explain it better

druagord's picture

He has: 335 posts

Joined: May 2003

Thanks any way at least now i know what to look for

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

serifs are the little pointy bits on type like Times New Roman.

Fonts are of a number of types -- fantasy, cursive, serif, sans-serif (without the pointy bits), monospace.

http://www.w3.org/TR/REC-CSS2/fonts.html#generic-font-families

Sometimes you'll want a particular type of font -- for very small fonts, sans-serif works better for clarity, while at larger sizes serif fonts often work better.

Print-wise you may prefer one family type over another as well.

druagord's picture

He has: 335 posts

Joined: May 2003

Wow thats nice i found out that serif is not just a meaningless name Smiling

thanks for the link i couldn't find that by myself maybe i miss some sleep. From what i read there the charset as something to do with what font will be displayed, but is there a way to know wich font from the family the browser will try first will it try the same thing on netscape or ie this is still not clear to me.

this is only to improve my personal knowledge base so no hurry Smiling

IF , ELSE , WHILE isn't that what life is all about

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Example:

font-family: arial, helvetica, geneva, verdana, sans-serif;

All browsers will display Arial if Arial is on the computer, if not, it will seek Helvetica and display the content in that, if not it will seek Geneva and display the content in that, if not it will seek Verdana and display the content in that, if not it will seek the computer settings (default) for "sans-serif display preference" and use that user-set font to display the content.

You have *no* control over what fonts are installed on the user's computer, nor what they set their default fonts to.

druagord's picture

He has: 335 posts

Joined: May 2003

ok so when i use a font family it refers to the browser default setting for that type face nice. now my logical side is satisfied.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.