Skip to content

<text-align>

The <text-align> CSS type represents alignments that can be applied to text.

Warning

Not to be confused with the text-align CSS rule that sets the alignment of text in a widget.

Syntax

A <text-align> can be any of the following values:

Value Alignment type
center Center alignment.
end Alias for right.
justify Text is justified inside the widget.
left Left alignment.
right Right alignment.
start Alias for left.

Tip

The meanings of start and end will likely change when RTL languages become supported by Textual.

Examples

CSS

Label {
    text-align: justify;
}

Python

widget.styles.text_align = "justify"