document.tags.fontFamily

JavaScript 1.2+ Nav4+ Syntax

document.tags.tagName.fontFamily

Description

The fontFamily property specifies the font an element should use when associated with the tag called tagName. More than one font can be specified, in case a particular font has not been loaded.

Example

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

Listing 7.175 Set the fontFamily Property
<html>

<script>
<!-- Hide

//Create a style sheet tag that defines a font
document.tags.P.fontFamily = "Arial, Helvetica";

//Hide End --->
</script>

<p>Do you like this font?</p>

</html>
							
						

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.