document.classes.fontStyle

JavaScript 1.2+ Nav4+ Syntax

document.classes.className.tagName.fontStyle

Description

The fontStyle property specifies the font style used by an element when associated with the class called className. The definition can also specify a tag or the word all for tagName.

The fontStyle property can be assigned one of the following values: normal or italic.

Example

Listing 7.75 uses the fontStyle property to italicize the header text.

Listing 7.75 Set the fontStyle Property
<html>

<script>
<!-- Hide

//Create a style sheet class that defines a font style
document.classes.I.all.fontStyle = "italic";

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

<h2 class=I>Italicized Heading</h2>

</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.