8.1. How CSS Deals With Fonts

With the emergence of CSS, the HTML <font> tag is deprecated in favor of using styles to achieve the same or better results.

Using CSS gives you great flexibility in working with fonts. While HTML limits you to working with only seven standard font sizes, CSS allows you to specify font sizes in a number of different ways, providing a nearly unlimited range of sizes. In addition, CSS formalizes the ability to define a fallback, or default, font to be used in case none of the fonts you specify in a style rule is available on the user's machine when your page is rendered. This capability existed with the deprecated <font> tag in HTML, but the list of defaults was never officially standardized.

With CSS, you also get the ability to change the weight of fonts (e.g. bold or normal), their style (e.g. italic or oblique), and even to declare a font to display in small caps.

The CSS properties you'll work with in this chapter include:

  • font-family

  • font-size

  • font-style

  • font-variant

  • font-weight

  • font (shorthand property)

Together, these properties give you considerable flexibility to control the appearance of text on your Web pages.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.145.114