SitePoint Sponsor

User Tag List

Results 1 to 14 of 14
  1. #1
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why do we declare serif, sans-serif in our font declarations?

    Hi,

    I would like to understand why we declare serif or sans-serif in our font declarations.

    For instance the following two don't have any difference in my browser.

    font-family: 'Century Gothic',sans-serif;
    font-family: 'Century Gothic',serif;

    Are we declaring serif type as a fallback option? For example, if the browser doesn't support our font are we telling the browser to show a serif or sans-serif font?

    Thanks!

  2. #2
    SitePoint Evangelist rhysboy84's Avatar
    Join Date
    May 2007
    Location
    Colwyn Bay, North Wales, UK
    Posts
    438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jumpist View Post

    Are we declaring serif type as a fallback option? For example, if the browser doesn't support our font are we telling the browser to show a serif or sans-serif font?
    In a word, yes.
    I'm Rhys Wynne & I blog at Winwar Media
    WP Email Capture: Free Email/Ebook Marketing Wordpress Plugin
    UK Based SEO? Tweet Your Location to #ukseohere!
    | My Brand New Brand | Twitter |

  3. #3
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't declare fonts in PHP. Post to the right forum next time.

  4. #4
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    jumpist, the browser goes through each font in your font-family (stack) and tries to apply that font to the text, if the font is unavailable it moves to the next... and the next... etc until it reaches the end, the serif/sans-serif/etc declaration basically says "if all else fails, just use the systems default serif/sans-serif/etc font".

    Quote Originally Posted by decowski View Post
    You don't declare fonts in PHP. Post to the right forum next time.
    Not very constructive.

  5. #5
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:


    Quote Originally Posted by AlexDawson View Post
    Not very constructive.
    More constructive than your comment on my comment. I know my comment wasn't "constructive" but the answer had already been given and I just wanted to let the OP know that they posted to the wrong forum.

    Your comment on my comment has no value.

  6. #6
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Great answers guys. It's good to learn something new. Thank you!!!

    Decowski,
    I couldn't see any CSS/HTML forums in Sitepoint. Maybe I missed it? Or maybe I just shouldn't post such questions at Sitepoint. Anyways, thanks for letting me know.

  7. #7
    Web Professional
    Join Date
    Oct 2008
    Location
    London
    Posts
    862
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is a CSS forum on SitePoint.

    And yes, you should post such questions on SitePoint. I didn't say the world was going to end because you posted in the wrong forum. I merely gave a hint.

  8. #8
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,788
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by jumpist View Post
    font-family: 'Century Gothic',sans-serif;
    font-family: 'Century Gothic',serif;
    Century Gothic is a sans-serif font so you'd use the first of those two options so that anyone who doesn't have Century Gothic would at least have the content displayed in a similar font.

    It is to stop their computer substituting a serif font that you'd specify a second option.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  9. #9
    John 8:24 JREAM's Avatar
    Join Date
    Sep 2007
    Location
    Florida
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I always hit up this page looking for a nice stack :P
    http://frozr.com/wp-content/uploads/2008/08/font.html

  10. #10
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by decowski View Post
    There is a CSS forum on SitePoint.

    And yes, you should post such questions on SitePoint. I didn't say the world was going to end because you posted in the wrong forum. I merely gave a hint.

    Thanks for the link. I really didn't see it before. Talk about being a newcomer.

    And don't worry, I didn't misunderstand you at all. Thanks for letting me know, seriously.

    Cheers!

  11. #11
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by felgall View Post
    Century Gothic is a sans-serif font so you'd use the first of those two options so that anyone who doesn't have Century Gothic would at least have the content displayed in a similar font.

    It is to stop their computer substituting a serif font that you'd specify a second option.

    Thank you!

  12. #12
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JREAM View Post
    I always hit up this page looking for a nice stack :P
    http://frozr.com/wp-content/uploads/2008/08/font.html
    Well nice tip! Nice site.

  13. #13
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    If you are looking for a good website which deals with various font stacks and families you can declare the following may be worth a peek...

    http://font-family.com/

  14. #14
    SitePoint Member
    Join Date
    Aug 2009
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AlexDawson View Post
    If you are looking for a good website which deals with various font stacks and families you can declare the following may be worth a peek...

    http://font-family.com/

    This site is very useful! Thank you!


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •