Revision 11692 of text-align

  • Revision slug: CSS/text-align
  • Revision title: text-align
  • Revision id: 11692
  • Created:
  • Creator: Jürgen Jeka
  • Is current revision? No
  • Comment 12 words added

Revision Content

{{ CSSRef() }}

Summary

The text-align property is used to to describe how lines of text are aligned with each other. Text-align does not control the alignment of elements, only their inline content.

  • {{ Xref_cssinitial() }}: user-agent specific and can depend on writing direction
  • Applies to: all block level elements
  • {{ Xref_cssinherited() }}: yes
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}:

Syntax

 text-align: left | center | right | justify | start | end | inherit

Values

  • left : line boxes within the element line up to the left inner content edge of the paragraph
  • right : line boxes within the element line up to the right inner content edge of the paragraph
  • center : line boxes within the element are centered within the content edges of the paragraph
  • justify : line boxes within the element line up their left and right edges to the left and right content edges of the paragraph
  • start  : line boxes within the element line up to the start of the line (the left content edge on left-to-right text systems or the right content edge on right-to-left text systems)
  • end : line boxes within the element line up to the end of the line (the right content edge on left-to-right text systems or the left content edge on right-to-left text systems) {{ gecko_minversion_inline("1.9.2") }}
  • -moz-center
  • -moz-left
  • -moz-right

Examples

{{ CSSRefExampleLink("text-align") }}

p.left { text-align: left }

p.right { text-align: right }

Notes

  • CSS2 included a <string> value that was dropped from CSS2.1 due to the lack of implementation.

Specifications

Browser compatibility

Browser Lowest Version
Internet Explorer 3
Netscape 4
Opera 3.5

See also

{{ CSS_Reference:Text() }}, {{ Cssxref("margin") }} (auto), {{ Cssxref("margin-left") }} (auto), {{ Cssxref("margin-right") }} (auto), {{ Cssxref("vertical-align") }}

{{ languages( { "fr": "fr/CSS/text-align", "it": "it/CSS/text-align" } ) }}

Revision Source

<p>{{ CSSRef() }}</p>
<h3 name="Summary">Summary</h3>
<p>The <code>text-align</code> property is used to to describe how lines of text are aligned with each other. Text-align does not control the alignment of elements, only their inline content.</p>
<ul> <li>{{ Xref_cssinitial() }}: user-agent specific and can depend on writing direction</li> <li>Applies to: all block level elements</li> <li>{{ Xref_cssinherited() }}: yes</li> <li>Media: {{ Xref_cssvisual() }}</li> <li>{{ Xref_csscomputed() }}:</li>
</ul>
<h3 name="Syntax">Syntax</h3>
<pre class="eval"> text-align: left | center | right | justify | start | end | inherit
</pre>
<h3 name="Values">Values</h3>
<ul> <li><strong>left</strong> : line boxes within the element line up to the left inner content edge of the paragraph</li> <li><strong>right</strong> : line boxes within the element line up to the right inner content edge of the paragraph</li> <li><strong>center</strong> : line boxes within the element are centered within the content edges of the paragraph</li> <li><strong>justify</strong> : line boxes within the element line up their left and right edges to the left and right content edges of the paragraph</li> <li><strong>start </strong> : line boxes within the element line up to the start of the line (the left content edge on left-to-right text systems or the right content edge on right-to-left text systems)</li> <li><strong>end</strong> : line boxes within the element line up to the end of the line (the right content edge on left-to-right text systems or the left content edge on right-to-left text systems) {{ gecko_minversion_inline("1.9.2") }}</li> <li>-moz-center</li> <li>-moz-left</li> <li>-moz-right</li>
</ul><h3 name="Examples">Examples</h3>
<p>{{ CSSRefExampleLink("text-align") }}</p>
<pre>p.left { text-align: left }

p.right { text-align: right }
</pre>
<h3 name="Notes">Notes</h3>
<ul> <li>CSS2 included a &lt;string&gt; value that was dropped from CSS2.1 due to the lack of implementation.</li>
</ul>
<h3 name="Specifications">Specifications</h3>
<ul> <li><a class="external" href="http://www.w3.org/TR/CSS1#text-align">CSS 1</a></li> <li><a class="external" href="http://www.w3.org/TR/CSS21/text.html#alignment-prop">CSS 2.1</a></li>
</ul>
<h3 name="Browser_compatibility">Browser compatibility</h3>
<table class="standard-table"> <tbody> <tr> <th>Browser</th> <th>Lowest Version</th> </tr> <tr> <td>Internet Explorer</td> <td>3</td> </tr> <tr> <td>Netscape</td> <td>4</td> </tr> <tr> <td>Opera</td> <td>3.5</td> </tr> </tbody>
</table>
<h3 name="See_also">See also</h3>
<p>{{ CSS_Reference:Text() }}, {{ Cssxref("margin") }} (<code>auto</code>), {{ Cssxref("margin-left") }} (<code>auto</code>), {{ Cssxref("margin-right") }} (<code>auto</code>), {{ Cssxref("vertical-align") }}</p>
<p>{{ languages( { "fr": "fr/CSS/text-align", "it": "it/CSS/text-align" } ) }}</p>
Revert to this revision