document.ids.textAlign

JavaScript 1.2+ Nav4+ Syntax

document.ids.idName.textAlign

Description

The textAlign property specifies the alignment of text within an element as associated with the ID called idName.

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

Example

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

Listing 7.133 Set the textAlign Property
<html>

<script>
<!-- Hide

//Create a style sheet id that defines the right alignment
document.classes.FORMAT.all.borderWidths(10)
document.ids.RIGHT.textAlign = "right";

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

<p class=FORMAT id=RIGHT>This text is aligned right.</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.