CSS3 Custom Fonts

5 posts Page 1 of 1
Contributors
User avatar
mikethedj4
VIP - Site Partner
VIP - Site Partner
Posts: 2592
Joined: Thu Mar 25, 2010 4:36 am

CSS3 Custom Fonts
mikethedj4
Custom fonts have been used on the web before CSS3 came out, but what we had to do was apply it in an image. We'll that time is gone now. We can add it right into our styling in CSS, and you've probably seen me do this already with the JavaScript Calculator, as well as NoteTaker.

So lets begin shall we?

NOTE: I'll be using the English font as an example.

First define your font, by giving it a name, and then grab the font url. (Caps matter)
Code: Select all
@font-face {
font-family:English;
src:url('fonts/English.ttf');}
Now that you've defined the font, whatever name you used you'd use that name to apply that custom font family in CSS3.

Here's a small example.
Code: Select all
div#example {
font-family:ThinTxt;
font-size:40px;
color:silver;}
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: CSS3 Custom Fonts
Dummy1912
wow cool :)
thanks for sharing didn't know that
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Codex
Coding God
Coding God
Posts: 2028
Joined: Wed Mar 31, 2010 5:50 pm

Re: CSS3 Custom Fonts
Codex
Or you could use Google Web Fonts:
http://www.google.com/webfonts#ChoosePlace:select
We shall let the revolution begin.. the revolution for freedom, freedom against censorship. We shall fight in the fields and in the streets, we shall fight in the hills; we shall never surrender
User avatar
mikethedj4
VIP - Site Partner
VIP - Site Partner
Posts: 2592
Joined: Thu Mar 25, 2010 4:36 am

Re: CSS3 Custom Fonts
mikethedj4
Thanks for the tip Codex. However I still recommend my tip from above, as it'll make the page load faster, and you're not hyperlinking as the font should be on your hosting account.
User avatar
Danny
VIP - Donator
VIP - Donator
Posts: 621
Joined: Sat Oct 30, 2010 8:21 pm

Re: CSS3 Custom Fonts
Danny
thanks for sharing!
5 posts Page 1 of 1
Return to “Tutorials”