470,563 Members | 2,018 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,563 developers. It's quick & easy.

how to use different fonts in css

hi there,
im having trouble in using different kind of font, well not really trouble, its just i dont know how to link the font i want to using. its not the default font that we use in html.
could you give me some example of that? or is it possible to do that?
have a great day , thanks
if there is any possibility please e-mail me..
xxxx@gmail.com.. or reply to my post.
Jan 29 '08 #1
3 1917
7,435 Expert 4TB
If the font is not installed on the user's computer, it cannot be used.
Jan 29 '08 #2
490 Expert 256MB
you can change the font a number of ways. look at this simple example....

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2.     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4. <head>
  5. <title>Page Title</title>
  6. <style type="text/css">
  7. body{
  8. /*this will change the font of the entire BODY to verdana*/
  9. font-family:Verdana;
  10. }
  11. p{
  12. /*this will change each "p" tag to be arial*/
  13. font-family:arial;
  14. }
  15. .myClass{
  16. /*this will change each element with a class attribute as "myClass" to tahoma*/
  17. font-family:tahoma;
  18. }
  19. #myID{
  20. /*this will change the element with an ID of "myID" to Courier new*/
  21. font-family:Courier New;
  22. }
  23. </style>
  25. </head>
  26. <body>
  27. <div>
  28.     <span>This font is verdana</span>
  29.     <p>This font is arial</p>
  30.     <span class="myClass">This font is tahoma</span>
  31.     <span id="myID">This font is Courier</span>
  32. </div>
  33. </body>
  34. </html>
Jan 29 '08 #3
7,435 Expert 4TB
Oops. Yes. I read "default font" meaning a font normally installed on computers, as in "custom font".
Jan 29 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by L | last post: by
4 posts views Thread by Aaron Gray | last post: by
12 posts views Thread by ctclibby | last post: by
53 posts views Thread by Jonas Smithson | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.