Fonts

In CSS2, the fonts module is used to define size, line height, and weight of a text, as well as other properties such as style and family.

In CSS we could use only predefined font families that were available on the computer, but CSS3 gives us the facility to use user-defined fonts which can be used to style the web forms.

The @font-face rule

Fonts play a major role in deciding how a page or a particular part of a page looks, and that's where the web designers and corporates take benefit, such as in the case of branding.

The @font-face property has taken the usage of fonts to the next level.

This rule allows users to specify any real fonts to the text on the web forms or page. To be more precise, this rule allows downloading a particular font from the server and using it in the web form or page if the user hasn't got that particular font already installed.

Syntax

The syntax for the @font-face property is as follows:

@font-face{
  font-family: <family-name>;
  src: <url>;
  unicode-range: <urange>;
  font-variant: <font-variant>;
  font-feature-settings: normal / <feature-tag-value>;
  font-stretch: <font-stretch>;
  font-weight: <weight>;
  font-style: <style>;
}

Font descriptors

CSS3 provides new font descriptors that can be defined inside the @font-face rule. Various font descriptors that can be used are as follows.

The src font descriptor

The src font descriptor is used to define the URL of the font.

Value: URL.

The font-style font descriptor

The font-style font descriptor is used to define the style of the font that is to be used. It is an optional field and the default is normal.

Values: normal, italic, and oblique.

The font-stretch font descriptor

The font-stretch font descriptor is used to define how much the font should be stretched. It is an optional field and the default is normal.

Value: normal, condensed, ultra-condensed, extra-condensed, semi-condensed, expanded, semi-expanded, extra-expanded, and ultra-expanded.

The font-family font descriptor

The font-family font descriptor is used to define the name or type of the font.

Value: name.

The unicode-range font descriptor

The unicode-range font descriptor is used to define the range of Unicode characters that the font supports. It is an optional field and by default its value is U+0-10FFFF.

Value: Unicode-range.

The font-weight descriptor

The font-weight font descriptor is used to define how bold the font should be. It is an optional field and by default it is normal.

Values: normal, bold, 100, 200, 300, 400, 500, 600, 700, 800, and 900.

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

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