Share via


textAlign property

Gets or sets the current anchor point or alignment settings for text in the current context.

 

Syntax

object.put_textAlign(
            string
           v);object.get_textAlign(
            string
          * p);

Property values

Type: string

start

Default. If the canvas is left-to-right, the anchor point is the left edge of the text. If the canvas is right-to-left, the anchor point is the right edge of the text.

end

If the canvas is left-to-right, the anchor point is the right edge of the text. If the canvas is right-to-left, the anchor point is the left edge of the text.

left

The anchor point is the left edge of the text.

right

The anchor point is the right edge of the text.

center

The anchor point is centered in the text.

Standards information

Remarks

The exact alignment depends on whether the direction of IHTMLCanvasElement is left-to-right (ltr) or right-to-left (rtl). The ICanvasRenderingContext2D::textBaseline value also determines the anchor point of the text.