[ 11 posts ] Go to page 1, 2 Next

Jennifer Kingston

  • Username: JenniferK
  • Joined: Sun May 08, 2011 10:24 pm
  • Posts: 1
  • Offline
  • Profile
Tags:

Custom fonts in HTML/CSS Pages

Post Posted: Sun May 08, 2011 10:35 pm
+0-
How will i use custom fonts in HTML or CSS pages?

Stefan SJoglimt

  • Username: Stefansjoglimt
  • Joined: Tue May 10, 2011 12:42 am
  • Posts: 2
  • IRC: Stefan
  • Offline
  • Profile

Re: Custom fonts in HTML/CSS Pages

Post Posted: Tue May 10, 2011 1:32 am
+0-
Hi Jennifer,

One requirement for a font to show in a visitors web page is that the specified font is installed in the visitors operating system. That is why, when you specify a font in CSS you should always specify a font-family. This way the web browser can select a similar font if the font is missing.

There is a solution to use a custom font in your web pages based on CSS3.

    1. To make custom fonts work in all modern web browsers including Internet Explorer you need to prepare 2 font files, one ttf or otf-file. This is a format that FF, Chrome and Safari can use. For Internet Explorer you also need to create a .eof-file. It can't use ttf/otf-files.
    2. Upload the custom font files to your web site.
    3. Add a @font-face declaration to your CSS file:
    Code:
    @font-face{
           font-family: my_custom_font;
           src:url('http://www.website.com/path/to/font/nice_font.eot');
           src: local(my_custom_font), url(''http://www.website.com/path/to/font/nice_font.ttf')   
                 format('opentype');
    }


    As you can see there are 2 src-assignments above. What happens is that the second assignment will overwrite the first one but since Internet Explorer doesn't understand the "local" keyword it will skip this assignment. It is not pretty but it gets the job done. It is very important that the IE assignment comes first and the "local" assignment after this.

    4. Then you can use the font in your CSS
    Code:
    .span{
          font-family: my_custom_font;
    }



There are also font tools that you can upload your font to and it will create the necessary files ttf/otf and eot files + CSS declarations.

Hope this was what you were looking for.

Bear Morin

  • Username: Bear88881
  • Joined: Sun May 22, 2011 10:45 am
  • Posts: 1
  • Offline
  • Profile

Re: Custom fonts in HTML/CSS Pages

Post Posted: Sun May 22, 2011 11:01 am
+0-
Thanks Stefan, I had no idea. This sure beats the boring limitations of Ariel, Times and Verana...

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 620
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile
Tags:

Re: Custom fonts in HTML/CSS Pages

Post Posted: Mon May 23, 2011 8:34 am
+0-
Google has this awesome service that makes embedding fonts really easy http://www.google.com/webfonts.

When do we get Yahoo! Fonts on the Yahoo CDN? :P I can see a lot of value in having browser-specific CSS for fonts delivered in the same combo as other CSS.

Jonathan BB

  • Username: JonathanB
  • Joined: Sat May 28, 2011 6:48 pm
  • Posts: 1
  • Offline
  • Profile

Re: Custom fonts in HTML/CSS Pages

Post Posted: Sat May 28, 2011 7:05 pm
+0-
Hi guys

I am wanting to make some changes with my current fonts on my wordpress website. I want to specifically change my theme fonts so can I do this by pasting the custom script above into the custom.php file??

I wait to hear your reply


Jonathan

mike williams

  • Offline
  • Profile
Tags:

Re: Custom fonts in HTML/CSS Pages

Post Posted: Mon May 30, 2011 8:29 am
+0-
Hi,

Can you explain how to include fonts in your css file? Pretty new to this stuff

Thanks
Mike

Darryl Ralphs

  • Username: canadahottub456
  • Joined: Mon May 30, 2011 10:41 am
  • Posts: 1
  • Offline
  • Profile

Re: Custom fonts in HTML/CSS Pages

Post Posted: Mon May 30, 2011 4:32 pm
+0-
i want to try some fonts of my own.. font-family somewhat similar to segoe scipt.

Sydney Litton

  • Username: sydneylitton
  • Joined: Wed Jun 01, 2011 2:35 pm
  • Posts: 1
  • Location: Phoenix, AZ
  • Offline
  • Profile

Re: Custom fonts in HTML/CSS Pages

Post Posted: Wed Jun 01, 2011 2:58 pm
+0-
With CSS you can use custom fonts on your website, usually visitors can only see the fonts that are already installed on their computers. So if you use a font that is not installed on your website visitor’s computer then his or her browser will show some other font that is there on the computer.

Nick Husher

YUI Contributor

  • Offline
  • Profile
Tags:

Re: Custom fonts in HTML/CSS Pages

Post Posted: Tue Jun 07, 2011 6:47 am
+0-
I've had some success with FontSquirrel as well. If you have embedding rights on a font, you can plug it into their @font-face generator to build a package that includes all the stuff you need to get a font onto a web site.

It even supports character subsetting, so you can pick out a handful of beautiful symbols from a font (such as ampersands) and stick them at the top of your font stack. Whenever one of those symbols is encountered, the custom font version will be used, otherwise it will pass through to the next font-face in the stack.

Helen Kidde

  • Username: helen21stc
  • Joined: Tue Jun 07, 2011 10:54 am
  • Posts: 1
  • Location: Brighton
  • Offline
  • Profile
Tags:

Re: Custom fonts in HTML/CSS Pages

Post Posted: Tue Jun 07, 2011 11:21 am
+0-
Hi, lots of the Google fonts looked really good and original but disappointing (though obvious) to read that others who visit your site will only be able to appreciate them if they happen to have them installed on their computer.
That wouldn't bother me too much except that I don't think you can predict what visitors default font will be and therefore won't be able to predict the relative font size, which makes it very risky to deviate from the boring standard stuff.
For example, I nearly always use Freestyle Script in blue to appear to be my signature. But this font is tiny compared to Tahoma or Georgia etc so I have to go up three sizes to get the scale right.
So if there was a similar Google font, it would be likely to look huge in someone esle's browser, which would make you look like an egomaniac!
Helen
  [ 11 posts ] Go to page 1, 2 Next
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum