aboutsummaryrefslogtreecommitdiff
path: root/files/pt-pt/web/css/font-size/index.html
blob: e3d0ca9fa8222f5ff66a077b38b1a2d417078559 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
title: font-size
slug: Web/CSS/font-size
tags:
  - Referencia_CSS
translation_of: Web/CSS/font-size
---
<p>{{ CSSRef() }}</p>

<h3 id="Resumo" name="Resumo">Resumo</h3>

<p>The font-size property specifies the size of the font. The font size may, in turn, change the size of other things, since it is used to compute the value of <code>em</code> and <code>ex</code> length units.</p>

<ul>
 <li>Valor inicial: <code>medium</code></li>
 <li>Aplica-se a: todos os elementos</li>
 <li>Herdado: sim</li>
 <li>Percentagens: relativas ao elemento font-size pai</li>
 <li>Mídia: <a href="pt/CSS/Media/Visual">Visual</a></li>
 <li>Valor computado: comprimento absoluto</li>
</ul>

<h3 id="Sintaxe" name="Sintaxe">Sintaxe</h3>

<p><code>font-size:</code> <code>xx-small</code> | <code>x-small</code> | <code>small</code> | <code>medium</code> | <code>large</code> | <code>x-large</code> | <code>xx-large</code></p>

<p><code>font-size:</code> <code>smaller</code> | <code>larger</code></p>

<p><code>font-size:</code> &lt;length&gt; | &lt;percentage&gt; | {{ Cssxref("inherit") }}</p>

<h3 id="Valores" name="Valores">Valores</h3>

<dl>
 <dt>xx-small, x-small, small, medium, large, x-large, xx-large </dt>
 <dd>A set of absolute size keywords based on the user's default font size (which is <code>medium</code>). Similar to presentational HTML's <code>&lt;font size="1"&gt;</code> through <code>&lt;font size="7"&gt;</code> where the user's default font size is <code>&lt;font size="3"&gt;</code>.</dd>
 <dt>larger, smaller </dt>
 <dd>Larger or smaller than the parent element's font size, by roughly the ratio used to separate the absolute size keywords above.</dd>
 <dt><a href="pt/CSS/length">&lt;length&gt;</a> </dt>
 <dd>A positive <a href="pt/CSS/length">length</a>.</dd>
 <dt>&lt;percentage&gt; </dt>
 <dd>A positive percentage of the parent element's font size.</dd>
</dl>

<p>It is best to avoid using values that are not relative to the user's default font size, such as &lt;lengths&gt; with units other than <code>em</code> or <code>ex</code>. However, if such values must be used, <code>px</code> are preferred over other units because their meaning does not vary depending on what the operating system thinks (generally incorrectly) the resolution of the monitor is.</p>

<h3 id="Exemplos" name="Exemplos">Exemplos</h3>

<p><a href="/samples/cssref/font-size.html">View Live Examples</a></p>

<pre>/* Set paragraph text to be very large. */
p { font-size: xx-large }

/* Set h1 (level 1 heading) text to be 2.5 times the size
 * of the text around it. */
h1 { font-size: 250% }

/* Sets text enclosed within span tag to be 16px */
span { font-size: 16px; }
</pre>

<h3 id="Notas" name="Notas">Notas</h3>

<p><code>em</code> and <code>ex</code> units on the {{ Cssxref("font-size") }} property are relative to the parent element's font size (unlike all other properties, where they're relative to the font size on the element). This means <code>em</code> units and percentages do the same thing for {{ Cssxref("font-size") }}.</p>

<h3 id="Especifica.C3.A7.C3.B5es" name="Especifica.C3.A7.C3.B5es">Especificações</h3>

<ul>
 <li><a class="external" href="http://www.w3.org/TR/CSS1#font-size">CSS 1 </a></li>
 <li><a class="external" href="http://www.w3.org/TR/CSS21/fonts.html#propdef-font-size">CSS 2.1</a></li>
 <li><a class="external" href="http://www.w3.org/TR/css3-fonts/#font-size">css3-fonts</a></li>
</ul>

<p><span class="comment">== Compatibilidade com navegadores ==</span></p>

<h3 id="Veja_tamb.C3.A9m" name="Veja_tamb.C3.A9m">Veja também</h3>

<p>{{ Cssxref("font") }} {{ Cssxref("font-family") }}, {{ Cssxref("font-size") }}, {{ Cssxref("font-size-adjust") }}, {{ Cssxref("font-style") }}, {{ Cssxref("font-variant") }}, {{ Cssxref("font-weight") }}, {{ Cssxref("line-height") }}</p>

<p><span class="comment">Categorias</span></p>

<p><span class="comment">Interwiki Language Links</span></p>

<p>{{ languages( { "en": "en/CSS/font-size", "fr": "fr/CSS/font-size" } ) }}</p>