LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   CSS and default fonts (https://www.linuxquestions.org/questions/programming-9/css-and-default-fonts-4175438238/)

Mr. Alex 11-22-2012 02:39 AM

CSS and default fonts
 
Hi folks.

If I don't specify font for say paragraphs in CSS, the default is used which in Windows most of the times == Times New Roman. Is not specifying font == specifying it as "serif"?

So

Code:

p {
  font-family: georgia;
}

equals

Code:

p {
  font-family: georgia, serif;
}

Right?
Or specifying "serif" at the end makes a difference?

Lexus45 11-22-2012 02:57 AM

Quote:

The font-family property should hold several font names as a "fallback" system. If the browser does not support the first font, it tries the next font.

Start with the font you want, and end with a generic family, to let the browser pick a similar font in the generic family, if no other fonts are available.
http://w3schools.com/css/css_font.asp

NyteOwl 11-22-2012 03:02 PM

Specifying no font used the browser default, not the system default. The browser will try and sue the font's named starting at the left and moving to the right as it doesn't find the font named. If it doesn't find any of the fonts named in the list it uses the browser default.

In your example 1, the browser would try and use georgia. If it didn't find georgia it would use the main browser default.

In your example 2, the browser would try and use georgia. If it didn't find georgia it would use whatever the browser default for serif fonts is set to.

Note the difference in the default behaviour.

Mr. Alex 11-23-2012 02:46 AM

Thanks, I got it now.


All times are GMT -5. The time now is 07:07 PM.