By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,396 Members | 1,869 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,396 IT Pros & Developers. It's quick & easy.

how to use different fonts in css

P: 1
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.. or reply to my post.
Jan 29 '08 #1
Share this Question
Share on Google+
3 Replies

Expert 5K+
P: 7,435
If the font is not installed on the user's computer, it cannot be used.
Jan 29 '08 #2

Expert 100+
P: 490
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.     "">
  3. <html xmlns="" 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

Expert 5K+
P: 7,435
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.