document.classes.textAlign

JavaScript 1.2+ Nav4+ Syntax

document.classes.className.tagName.textAlign

Description

The textAlign property specifies the alignment of text within an element as associated with the class called className. The definition can also specify a tag or the word all for tagName.

There are four types of values that are valid for the textAlign property: left, right, center, and justify.

Example

Listing 7.89 uses textAlign property to align the text to the right.

Listing 7.89 Set the textAlign Property
 <html> <script> <!-- Hide //Create a style sheet class that defines right alignment document.classes.RIGHT.all.borderWidths(10) document.classes.RIGHT.all.textAlign = "right"; //Hide End ---> </script> <p class=RIGHT>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.