document.tags.textAlign

JavaScript 1.2+ Nav4+ Syntax

document.tags.tagName.textAlign

Description

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

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

Example

Listing 7.191 uses the textAlign property to align the text to the right side of the browser window.

Listing 7.191 Set the textAlign Property
<html>

<script>
<!-- Hide

//Create a style sheet tag that defines right alignment
document.tags.P.borderWidths(10)
document.tags.P.textAlign = "right";

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

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