CSS
  1. CSS intro
  2. CSS stylesheets
  3. CSS syntax
  4. CSS Classes & ID's
  5. CSS comments
  6. CSS BG properties
  7. CSS text properties
  8. CSS font properties
  9. CSS list properties
  10. CSS border properties
  11. CSS margin properties
  12. CSS padding properties
  13. CSS outline properties
  14. CSS table properties
  15. CSS dim properties
  16. CSS class properties
  17. CSS position properties
  18. CSS pseudo classes
  19. CSS pseudo elements
  20. CSS shortcuts
  21. CSS media types
  22. CSS summary

CSS font properties

With CSS font properties, you can specify the font a text will be displayed in and the size of the text.

This tutorial focuses on:

Setting text font

Text font is set with the font-family property. You can specify a list of fonts with this property and the web browser will use the first font that is found on the user's computer.

Example:
<html> <head> <title>Background properties</title> <style type="text/css"> h1 {font-family: helvetica, georgia;} p {font-family: tahoma, "trebuchet ms"} </style> </head> <body> <h1>Some text</h1> <p>Some more text</p> </body> </html>
Output:

Some text

Some more text

Setting text size

Text size is set with the font-size property. You can specify a size from a set of prefixed sizes or set your own size for text.

Some prefixed text sizes: - x-small, small, medium, large, x-large

Example:
<html> <head> <title>Setting a background image</title> <style type="text/css"> h1 {font-size: 40px;} p {font-size: large;} </style> </head> <body> <h1>Some text</h1> <p> A sentence in a paragraph. Another sentence in a paragraph. </p> </body> </html>
Output:

Some text

A sentence in a paragraph. Another sentence in a paragraph.

© Copyright 2013-2014 Landofcode.com
Terms of use | Privacy policy | Copyright information