document.classes.fontFamily

JavaScript 1.2+ Nav4+ Syntax

document.classes.className.tagName.fontFamily

Description

The fontFamily property specifies the font an element should use when associated with the class called className. The definition can also specify a tag or the word all for tagName. More than one font can be specified, in case a particular font has not been loaded.

Example

Listing 7.73 uses the fontFamily property to create text with an Arial font. If that font is not available, Helvetica is used.

Listing 7.73 Set the fontFamily Property
 <html> <script> <!-- Hide //Create a style sheet class that defines a font document.classes.F.all.fontFamily = "Arial,Helvetica"; //Hide End ---> </script> <p class=F>Do you like this ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.