SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Zealot
    Join Date
    May 2002
    Location
    USA
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Stylesheet Question

    Can you use a stylesheet to force a font? Say the user's browser is set to use arial, but your page uses a font you created. Is there a way to make that page display the font you created? And is a stylesheet the way you accomplish this? Or how would you do this? Thanks.

    JRF2k
    Man can learn nothing except by going from the known to the the unknown. -- Claude Bernard

  2. #2
    SitePoint Wizard
    Join Date
    Jul 2001
    Location
    The Netherlands
    Posts
    2,617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A stylesheet is indeed the way to go, yes. Just use the following code in your styles to force a font to be used:

    Code:
    <style type="text/css"> 
    @font-face{ 
    font-family: "JeFontNaam"; 
    src: url("JeEigenFont.eot"); 
    } 
    </style>
    I am not sure if this is browser compatible though, and highly doubt that.
    Last edited by Mark T.; Jun 5, 2002 at 02:29.

  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)
    Here's a link to a site that talks about your situation:
    http://www.netmechanic.com/news/vol3/css_no15.htm

    If you're simply asking whether or not you can override the users font with another font then that's easy and yes it can be done with stylesheets. Put this line in your HEAD tag:

    <style type="text/css">
    <!--

    body { font-family: verdana; }

    -->
    </style>

    This will cause this particular web page to use verdana unless the user has their built-in browser stylesheet set to override any website settings (which you CAN do). This is unlikely though as most people don't bother with the settings.
    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)
    If you're wanting to use some sort of proprietary font you've created, that's a bit more difficult since the user isn't going to have that font installed on his/her system. Somehow you're going to have to get them to download the font and install it on their system -- which isn't easy (if I visit a site which requests that I download and install a font, I am not likely to do so).

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

  5. #5
    SitePoint Zealot
    Join Date
    May 2002
    Location
    USA
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the replies. So, I guess I am limited by the fonts that are common to all Window and Mac PCs. I found this font that I like, but if I have to get people to download it first or whatever I'll just find another one. Thanks again.

    JRF2k.
    Man can learn nothing except by going from the known to the the unknown. -- Claude Bernard

  6. #6
    SitePoint Evangelist worksdev's Avatar
    Join Date
    Mar 2002
    Location
    Central, PA - originally from Monterey, CA
    Posts
    497
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Mark T.

    Code:
    src: url("JeEigenFont.ttf");
    Mark:
    Does this line have thier browser somehow download the font (at least for display)?

  7. #7
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by worksdev
    Mark:
    Does this line have thier browser somehow download the font (at least for display)?
    I didn't even see that in Mark's example.... I do not think that would work -- but I may be wrong.

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

  8. #8
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you really think that a particular font is crucial to the design of your site then either make it an image where needed or simply tell the person that they can download this font and "it will make the website look better".
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  9. #9
    SitePoint Wizard
    Join Date
    Jul 2001
    Location
    The Netherlands
    Posts
    2,617
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just validated my code example ay W3, and there were no problems at all with it. I never use this technique, but I am fairly certain it works.
    I just dug up a few links on this:

    - http://msdn.microsoft.com/library/de...s/fontface.asp
    - http://www.blooberry.com/indexdot/cs...s/fontface.htm

    So, the code is valid that is for sure, and I think it should work.

  10. #10
    SitePoint Wizard
    Join Date
    Oct 2001
    Location
    Tucson, Arizona
    Posts
    1,858
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A couple things to note. You can't link directly to TrueType font files. The URL must point to an embedded OpenType file (.eot or .ote format). You'll need to download this program to make that happen. Hope this helps you out.


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
  •