If there is an essential aspect of CSS that is the new approach introduced for the management of the text. First there was the <font>: pages heavy and difficult to manage. Today, something that can transform a website into a perfect example of a typeface, and finally agrees, at least in part, the power and flexibility of a word-processor. The properties that define how the text appears on the screen are many and we decided to split the argument into two classes. We start from the basic properties. Are those that define the following aspects:
- the font to use
- its size
- its consistency
- the spacing between paragraphs
- text alignment
- its decoration (underline, etc.)
font-family
Font-family property is used to set the font of your text. It applies to all elements and is inherited. The men of the W3C have created a mechanism that allows the author to set fonts in CSS is not a single one, but a list of alternate characters. The mechanism works like this:
p {font-family: arial, Verdana, sans-serif;}
When the page is loaded, the browser will attempt to use the first font on the list. If this is not available will use the second. In the absence of this too will use the main font family sans-serif font on the system. The explanation for this is simple: to tackle the problem of fonts on different software platforms. So, when you set the font-family you can use any font you want, but never forget to include a statement at the end of a generic family. They are five (in parentheses report the default fonts on Windows systems on each):
- serif (Times New Roman)
- sans-serif font (arial)
- cursive (Comic Sans)
- fantasy (Allegro BT)
- monospace (Courier)
The names of the font on the list should be separated by commas. Characters with names consisting of several words should be placed in quotation marks. If you use families as strange and unusual fantasy or cursive use more than one generic family. This should always be put at the end, otherwise it is practically useless to the definition of specific fonts.
selector {font-family: <font 1>, <font2>, ....,< family generic>;}
Bookmarks