SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 29
  1. #1
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Basic CSS question

    Hey

    when using this:

    .someclass {font-family: tahoma, verdana, arial, sans-serif};

    Does the browser use the font in the order it is listed assuming it is on the computer?

    I want people to use Tahoma as the font (I am getting a bit sick of Verdana) but it seems it always shows up as Verdana.

    What is the correct way to use this tag?
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  2. #2
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, it runs through it by order and displays the first font that is available (Generally).

    So, using your code, if the user doesn't have tahoma on the computer, then the browser will display verdana, et cetera, et cetera.

    Another thing you might want to check, however, is your browser preferences. Sometimes that can be the source of your problem.

    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  3. #3
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Browser preferences will only come into play if the webpage has not specified a font or unless the user has set their internal stylesheet to override any browser settings.

    If you're getting Verdana, then it might mean that you don't have Tahoma.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  4. #4
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yup; exactly what creole said.

    He's so smart, don't you think?
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  5. #5
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I do have Tahoma. That's how I know I like it!

    I'm pretty sure it is displaying correctly.

    Just out of interest, how common is Tahoma? Is it a system bundled font?
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  6. #6
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It may be -- I don't know. I'll let someone else answer that.

    However, I know this pretty much covers everying and I always use it in this order:

    arial, helvetica, verdana, sans-serif
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  7. #7
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tahoma comes with IE in newer versions. Or Microsoft offers a "font package" download from their site that includes Tahoma.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  8. #8
    Former Staff Member silver trophy Adam P.'s Avatar
    Join Date
    Apr 2001
    Location
    San Francisco
    Posts
    3,288
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    did u say that you have Tahoma on your computer? But verdana is coming up?

    Try this:

    Go to Start > Settings > Control Panel

    Open the "Fonts" folder. Scan through and find Tahoma. A lot of the time fonts might have something like "MT" at the end. Some programs won't show the MT because it isn't really that important. If you don't have "tahoma mt" in your stylesheet and the font name really is "tahoma mt", then it will go to the next font.

    BTW, if the font name is "tahoma mt" make sure you use quotes around it in your stlyesheet. Anything that is more than one word should have quotes. Example:

    .someclass {font-family: "tahoma mt", verdana, arial, sans-serif};

    Hope I help

    EDIT: just checked my fonts and it's only "tahoma". sorry, might be different on yours
    SPF Mentor/Advisor 2001-2003
    SPF Designer of the Year 2002
    SPF Graphic Designer of the Year 2003
    AdamPolselli.com

  9. #9
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have Tahoma. In fact I have it twice. And Tahoma Bold.

    I'll try removing one of the Tahoma's.

    I got about a million and one fonts bundled with corel 10. They all look the same but Ive got no room to add new ones, and cant be bothered to go through and delete them.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  10. #10
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oops. Now everything is bold. Need to fix that.

    Are fonts case sensitive in stylesheets?
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  11. #11
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't believe so.

    I always use lowercase because that's what the standards seem to prefer (plus -- it looks nicer and is easier to work with when everything is all lowercase).
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  12. #12
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    didnt think they would be somehow, but you never know. i know how picky some browsers can be (especially NS) for example fontfamily would work in IE but wouldn't in NS (I think!? NS needs the - i think).

    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  13. #13
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by weirdbeardmt
    didnt think they would be somehow, but you never know. i know how picky some browsers can be (especially NS) for example fontfamily would work in IE but wouldn't in NS (I think!? NS needs the - i think).

    Then IE should be spanked. The standards says with a dash.

    Anyway, if you keep to the standards, Mozilla/Netscape 6 should interpret CSS perfectly, IE5/5.5 did not get the CSS box model correct, but don't worry about it too much now.

    Netscape 4 is an issue, there are certain things to consider.

  14. #14
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    font-family works in IE5.x, NS 4.7x, and Mozilla/NS6.x....
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  15. #15
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Basic CSS question

    I just noticed something. When you use this:
    Originally posted by weirdbeardmt
    .someclass {font-family: tahoma, verdana, arial, sans-serif};
    The syntax is completely wrong -- you have a ; after the } which is not good. Plus, you're missing spaces between the {'s and the properties and the properties and the }'s.

    Use this instead:
    Code:
    .someclass { font-family : tahoma, verdana, arial, sans-serif ; }
    See if that makes any difference.
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  16. #16
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Aes
    font-family works in IE5.x, NS 4.7x, and Mozilla/NS6.x....
    It was just an observation at the differences in CSS browser compatibility. Like if you used this:

    .something {font-colour: ;}

    IE would continue and display anything after it, whereas NS would get annoyed, and lose any further formatting in the stylesheet.



    I just noticed something. When you use this:

    quote:
    --------------------------------------------------------------------------------
    Originally posted by weirdbeardmt
    .someclass {font-family: tahoma, verdana, arial, sans-serif};
    --------------------------------------------------------------------------------


    The syntax is completely wrong -- you have a ; after the } which is not good. Plus, you're missing spaces between the {'s and the properties and the properties and the }'s.
    Actually, that wasn't taken out of my actual stylesheet I just quickly typed it out, and got it wrong - in the actual file the }'s and the ;'s are the right way around.

    But I didn't know about the need of the spaces. What difference does that make?
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  17. #17
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually I don't believe the spaces are mandatory, but yeah that semi-colon should go into the curly bracket.

  18. #18
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The spaces aren't mandatory in the capacity that browsers interpret them -- but it is good practice to put them in.

    Mainly it makes your stylesheets cleaner, and it's more valid according to W3C's standards.
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  19. #19
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Aes
    The spaces aren't mandatory in the capacity that browsers interpret them -- but it is good practice to put them in.

    Mainly it makes your stylesheets cleaner, and it's more valid according to W3C's standards.
    I really don't mean to question you, but where is this mentioned in the standards? I'm just curious, because I don't recall seeing this mentioned anywhere.

    Anyway, yeah it is always good practise to make your code more legible. This is how I do my CSS:

    Code:
    p { 
      font-weight: bold; 
      font-size: 12pt;
      font-family: helvetica; 
    }

  20. #20
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's not mentioned in the standards, but they are given as examples.

    And I'm primarily referring to global stylesheets -- not the linked ones. Returns should have the same effect.
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  21. #21
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I really think the white spaces are in the examples to improve legibility, and have no effect on how clients interpret them. I mean, if there must be white spaces to guarantee correct parsing, it would have been explicitly mentioned right?

    Hmm...wasn't there a discussion on the very same topic some time ago? Here we go again.

  22. #22
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I remember reading it to.

    But referring to legibility...

    I dont understand people who write their sheets like this:

    .thistag {font-family: lots of different fonts; font-color: a colour; font-size: a size...}

    OK so the example doesn't work too well but they write it as one enormous long list on one line. It makes it really hard to read. I prefer putting each element on a new line, and presumably, the extra blank lines in the page don't increase the file size?
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  23. #23
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by weirdbeardmt
    OK so the example doesn't work too well but they write it as one enormous long list on one line. It makes it really hard to read. I prefer putting each element on a new line, and presumably, the extra blank lines in the page don't increase the file size?
    It does actually. Every carriage return (everytime you press Enter) adds one or two bytes. Every space adds a byte. Every tab adds a byte.

    These bytes adds up for a busy website.

  24. #24
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Right OK, so then big stylesheets which are written legibly are actually making the site slower?

    That can't be good.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  25. #25
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The size increase is pretty negligible unless you are running some millions of hits per month site I would think.

    The user should not notice any drastically longer load times unless he's on something like 33.6, it is your bandwidth costs that is an issue here.


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
  •