document.tags.fontStyle

JavaScript 1.2+ Nav4+ Syntax

document.tags.tagName.fontStyle

Description

The fontStyle property specifies the font style used by an element when associated with the tag called tagName.

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

Example

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

Listing 7.177 Set the fontStyle Property
<html>

<script>
<!-- Hide

//Create a style sheet tag that defines a font style
document.tags.H2.fontStyle = "italic";

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

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