Частный вебмастер Услуги Контакты Справочная информация Статьи и публикации Полезные сервисы Букварь вебмастера
   Букварь вебмастера

Атрибут font-family

font-family Attribute

{ font-family: [[ <family-name> | <generic-family> ] , ]* [ <family-name> | <generic-family> ]}

Sets the font-family.

This attribute is inherited.


The value is a prioritized list of font family names and/or generic family names. List items are separated by white space. If the font family name contains white space, it should be quoted with single or double quotes.

In level 1, the following generic families are defined:

'serif' (e.g. Times)

'sans-serif' (e.g. Helvetica)

'cursive' (e.g. Zapf-Chancery)

'fantasy' (e.g. Western)

'monospace' (e.g. Courier)

Style sheet writers are encouraged to offer a generic font family at the end of the list:

BODY { font-family: univers helvetica sans-serif }

BODY { font-family: 'new century schoolbook' serif }

BODY { font-family: "Bill's own font" fantasy }

Ideally, the style sheet designer should specify only one font, and the font manager should return the best alternative (perhaps by taking visual similarity, visual quality and performance into account). Unfortunately, current rendering environments do not offer this level of service, and it is beyond the style sheet mechanism to do so. Therefore, a prioritized list of alternative families can be supplied. This practice poses one problem: the UA must be able to determine if a font selection has been successful or not to know how far it should proceed in the list. One example: if the style sheet asks for 'univers' and the window system is smart enough to suggest 'helvetica' (which looks almost identical) as a replacement, is this a success or failure? This specification leaves the answer undefined for now.

Смотрите далее: font-size »

  Атрибуты CSS