Revision 11688 of text-align

  • Revision slug: CSS/text-align
  • Revision title: text-align
  • Revision id: 11688
  • Created:
  • Creator: Federico
  • Is current revision? No
  • Comment added lang: IT

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

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 | inherit
</pre>
<h3 name="Values"> Values </h3>
<ul><li> <b>left</b> : line boxes within the element line up to the left inner content edge of the paragraph
</li><li> <b>right</b> : line boxes within the element line up to the right inner content edge of the paragraph
</li><li> <b>center</b> : line boxes within the element are centered within the content edges of the paragraph
</li><li> <b>justify</b> : line boxes within the element line up their left and right edges to the left and right content edges of the paragraph
</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>{{ languages( { "fr": "fr/CSS/text-align", "it": "it/CSS/text-align" } ) }}
Revert to this revision