Skip to main content

HTML Guide

CSS: “text-align”: X is not a “text-align” value.

The text-align property in CSS only accepts specific keywords such as left, right, center, justify, start, or end.

W3C validation errors like this occur when an unsupported value is used for the text-align property. Valid values for text-align are standard keywords or certain global values. Custom or invalid values (like middle, or arbitrary text) are not permitted and will trigger validation errors.

Valid examples of text-align:

<p style="text-align: left;">This text is left-aligned.</p>
<p style="text-align: right;">This text is right-aligned.</p>
<p style="text-align: center;">This text is centered.</p>
<p style="text-align: justify;">This text is justified.</p>

Invalid example:

<p style="text-align: middle;">This will fail validation.</p>

To resolve the issue, always use a valid keyword for text-align.

Learn more:

Related W3C validator issues