CSS has several options for defining the styles of text.
These options can entirely replace the <font> tag, but there's even more. CSS allows you to define these styles much more powerfully than you could ever do with plain HTML.
FONT PROPERTIES
4P:problems, 4M:Mac only, 4W:Windows only
ASSIGNING ALL FONT ATTRIBUTES AT ONCE
An example of a typical font definition would be:
But since all font attributes can actually be expressed with the font property we could actually write it this way:
The above is obviously a shorter way to specify font settings - but in reality it is less useful than one might think. The reason is that you'd be assigning the same font face to all your styles, for example, while you'd want different font weights and sizes for headers and content areas etc.
TEXT PROPERTIES
Despite the font properties listed above there are some options for defining text properties such as alignments, underlines, etc.
4P:problems, 4M:Mac only, 4W:Windows only
The official CSS standard provided by W3C also includes properties for word spacing, letter spacing and vertical align, but these aren't supported by today's browsers.
COLORS
As you can see, the above CSS properties can replace all text formatting that can be done with plain HTML with one exception: the color.
The color is not part of the font collection in CSS - rather it has its own definition.
If you want to add a color to the text in the above example you'd do it this way:
The color property is explained in detail on the next page.
These options can entirely replace the <font> tag, but there's even more. CSS allows you to define these styles much more powerfully than you could ever do with plain HTML.
FONT PROPERTIES
|
4P:problems, 4M:Mac only, 4W:Windows only
ASSIGNING ALL FONT ATTRIBUTES AT ONCE
An example of a typical font definition would be:
|
But since all font attributes can actually be expressed with the font property we could actually write it this way:
|
The above is obviously a shorter way to specify font settings - but in reality it is less useful than one might think. The reason is that you'd be assigning the same font face to all your styles, for example, while you'd want different font weights and sizes for headers and content areas etc.
TEXT PROPERTIES
Despite the font properties listed above there are some options for defining text properties such as alignments, underlines, etc.
|
4P:problems, 4M:Mac only, 4W:Windows only
|
The official CSS standard provided by W3C also includes properties for word spacing, letter spacing and vertical align, but these aren't supported by today's browsers.
COLORS
As you can see, the above CSS properties can replace all text formatting that can be done with plain HTML with one exception: the color.
The color is not part of the font collection in CSS - rather it has its own definition.
If you want to add a color to the text in the above example you'd do it this way:
|
The color property is explained in detail on the next page.
0 comments:
Post a Comment