diff options
Diffstat (limited to 'files/pt-br/web/css/text-align/index.html')
-rw-r--r-- | files/pt-br/web/css/text-align/index.html | 337 |
1 files changed, 337 insertions, 0 deletions
diff --git a/files/pt-br/web/css/text-align/index.html b/files/pt-br/web/css/text-align/index.html new file mode 100644 index 0000000000..9789af412c --- /dev/null +++ b/files/pt-br/web/css/text-align/index.html @@ -0,0 +1,337 @@ +--- +title: text-align +slug: Web/CSS/text-align +tags: + - CSS + - Propriedade CSS + - Referencia + - Texto CSS +translation_of: Web/CSS/text-align +--- +<p>{{CSSRef}}</p> + +<h2 id="Sumário">Sumário</h2> + +<p><span class="seoSummary">A propriedade CSS <strong><code>text-align</code></strong> descreve como conteúdo inline, como texto, é alinhado no elemento pai em bloco. <code>text-align</code> não controla o alinhamento de elementos em bloco, apenas o seu conteúdo inline.</span></p> + +<p>{{cssinfo}}</p> + +<h2 id="Sintaxe">Sintaxe</h2> + +<pre class="brush: css notranslate">/* Keyword values */ +text-align: left; +text-align: right; +text-align: center; +text-align: justify; +text-align: justify-all; +text-align: start; +text-align: end; +text-align: match-parent; + +/* Block alignment values (Non-standard syntax) */ +text-align: -moz-center; +text-align: -webkit-center; + +/* Global values */ +text-align: inherit; +text-align: initial; +text-align: unset; +</pre> + +<h3 id="Valores">Valores</h3> + +<dl> + <dt><code>start</code> {{experimental_inline}}</dt> + <dd>Igual <code>left</code> se a direção é esquerda-para-direita e <code>right</code> se a direção é direita-para-esquerda.</dd> + <dt><code>end</code> {{experimental_inline}}</dt> + <dd>Igual <code>right</code> se a direção é esquerda-para-direita e <code>left</code> se a direção é direita-para-esquerda.</dd> + <dt><code>left</code></dt> + <dd>O conteúdo é alinhado na borda esquerda do box.</dd> + <dt><code>right</code></dt> + <dd>O conteúdo é alinhado na borda direita do box.</dd> + <dt><code>center</code></dt> + <dd>Os conteúdos inline são centralizados entre a linha da caixa.</dd> + <dt><code>justify</code></dt> + <dd>Os conteúdos inline são justificados. Text should be spaced to line up its left and right edges to the left and right edges of the line box, except for the last line.</dd> + <dt><code>justify-all</code></dt> + <dd>Semelhante a <code>justify</code>, porém força a última linha a ser justificada.</dd> + <dt><code>match-parent</code> {{experimental_inline}}</dt> + <dd>Similar to <code>inherit</code>, but the values <code>start</code> and <code>end</code> are calculated according the parent's {{cssxref("direction")}} and are replaced by the adequate <code>left</code> or <code>right</code> value.</dd> +</dl> + +<h3 id="Sintaxe_Formal">Sintaxe Formal</h3> + +<pre class="syntaxbox notranslate">{{csssyntax}}</pre> + +<h2 id="Exemplos">Exemplos</h2> + +<h3 id="Alinhamento_Esquerdo">Alinhamento Esquerdo</h3> + +<h4 id="HTML">HTML</h4> + +<pre class="brush: html notranslate"><p class="example"> + Integer elementum massa at nulla placerat varius. + Suspendisse in libero risus, in interdum massa. + Vestibulum ac leo vitae metus faucibus gravida ac in neque. + Nullam est eros, suscipit sed dictum quis, accumsan a ligula. +</p></pre> + +<h4 id="CSS">CSS</h4> + +<pre class="brush: css; highlight:[2] notranslate">.example { + text-align: left; + border: solid; +}</pre> + +<h4 id="Resultado">Resultado</h4> + +<p>{{EmbedLiveSample("Left_alignment","100%","100%")}}</p> + +<h3 id="Texto_centralizado">Texto centralizado</h3> + +<h4 id="HTML_2">HTML</h4> + +<pre class="brush: html notranslate"><p class="example"> + Integer elementum massa at nulla placerat varius. + Suspendisse in libero risus, in interdum massa. + Vestibulum ac leo vitae metus faucibus gravida ac in neque. + Nullam est eros, suscipit sed dictum quis, accumsan a ligula. +</p></pre> + +<h4 id="CSS_2">CSS</h4> + +<pre class="brush: css; highlight:[2] notranslate">.example { + text-align: center; + border: solid; +}</pre> + +<h4 id="Resultado_2">Resultado</h4> + +<p>{{EmbedLiveSample("Centered_text","100%","100%")}}</p> + +<h3 id="Justificado">Justificado</h3> + +<h4 id="HTML_3">HTML</h4> + +<pre class="brush: html notranslate"><p class="example"> + Integer elementum massa at nulla placerat varius. + Suspendisse in libero risus, in interdum massa. + Vestibulum ac leo vitae metus faucibus gravida ac in neque. + Nullam est eros, suscipit sed dictum quis, accumsan a ligula. +</p></pre> + +<h4 id="CSS_3">CSS</h4> + +<pre class="brush: css; highlight:[2] notranslate">.example { + text-align: justify; + border: solid; +}</pre> + +<h4 id="Resultado_3">Resultado</h4> + +<p>{{EmbedLiveSample("Justify","100%","100%")}}</p> + +<h3 id="Notas">Notas</h3> + +<p>O modo compátivel-padrão de centralizar um bloco em si sem centralizar seu conteúdo inline é setando a {{cssxref("margin")}} left e right para <code>auto</code>, e.g.:</p> + +<pre class="brush: css notranslate">.something { + margin: auto; +} +</pre> + +<pre class="brush: css notranslate">.something { + margin: 0 auto; +} +</pre> + +<pre class="brush: css notranslate">.something { + margin-left: auto; + margin-right: auto; +} +</pre> + +<h2 id="Especificações">Especificações</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Especificação</th> + <th scope="col">Status</th> + <th scope="col">Comentário</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('CSS Logical Properties', '#text-align', 'text-align')}}</td> + <td>{{Spec2('CSS Logical Properties')}}</td> + <td>Sem mudanças</td> + </tr> + <tr> + <td>{{SpecName('CSS3 Text', '#text-align-property', 'text-align')}}</td> + <td>{{Spec2('CSS3 Text')}}</td> + <td>Added the <code>start</code>, <code>end</code>, and <code>match-parent</code> values. Changed the unnamed initial value to <code>start</code> (which it was).</td> + </tr> + <tr> + <td>{{SpecName('CSS2.1', 'text.html#alignment-prop', 'text-align')}}</td> + <td>{{Spec2('CSS2.1')}}</td> + <td>Sem mudanças</td> + </tr> + <tr> + <td>{{SpecName('CSS1', '#text-align', 'text-align')}}</td> + <td>{{Spec2('CSS1')}}</td> + <td>Definição iniciaç</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibilidade">Browser compatibilidade</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Edge</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Suporte básico (<code>left</code>, <code>right</code>, <code>center</code> and <code>justify</code>)</td> + <td>1.0</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoDesktop("1.0")}}</td> + <td>3.0</td> + <td>3.5</td> + <td>1.0 (85)</td> + </tr> + <tr> + <td>Block alignment values {{non-standard_inline}}</td> + <td>1.0{{property_prefix("-webkit")}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatGeckoDesktop("1.0")}}{{property_prefix("-moz")}}<sup>[1]</sup></td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>1.0 (85){{property_prefix("-khtml")}}<br> + 1.3 (312){{property_prefix("-webkit")}} [1]</td> + </tr> + <tr> + <td><code>start</code> {{experimental_inline}}</td> + <td>1.0</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatGeckoDesktop("1.0")}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>3.1 (525)</td> + </tr> + <tr> + <td><code>end</code> {{experimental_inline}}</td> + <td>1.0</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatGeckoDesktop("1.9.2")}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>3.1 (525)</td> + </tr> + <tr> + <td><code>match-parent</code>{{experimental_inline}}</td> + <td>16</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatGeckoDesktop("40")}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Chrome for Android</th> + <th>Edge</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Suporte básico</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td>Block alignment values {{non-standard_inline}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>start</code> {{experimental_inline}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>end</code> {{experimental_inline}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>match-parent</code>{{experimental_inline}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatGeckoMobile("40")}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + <tr> + <td><code>true</code>(non-standard syntax){{non-standard_inline}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] Both WebKit and Gecko support a prefixed version of <code>left</code>, <code>center</code>, and <code>right</code>, that applies not only to inline content but also to block elements. This is used to implement the legacy {{htmlattrxref("align", "td")}} attributes on table elements and <code><center></code>. Do not use these on production Web sites.</p> + +<h2 id="Veja_também">Veja também</h2> + +<ul> + <li>{{Cssxref("margin","margin:auto")}}, {{Cssxref("margin-left","margin-left:auto")}}, {{Cssxref("vertical-align")}}</li> +</ul> |