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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
---
title: height
slug: Web/CSS/height
translation_of: Web/CSS/height
---
<div>{{CSSRef()}}</div>
<h2 id="Summary" name="Summary">Sumário</h2>
<p>A propriedade <code>height</code> do CSS determina a altura da área do conteúdo de um elemento. A <a href="/en-US/docs/CSS/box_model#content" title="CSS/Box_model#content">área de conteúdo</a> consiste no <code>padding</code>, <code>margin</code> e <code>border </code>do elemento.</p>
<p>As propriedades {{Cssxref("min-height")}} e {{Cssxref("max-height")}} sobrepõem a {{Cssxref("height")}}.</p>
<p>{{cssinfo}}</p>
<h2 id="Syntax" name="Syntax">Sintaxe</h2>
<pre class="twopartsyntaxbox"><a href="/en-US/docs/CSS/Value_definition_syntax" title="CSS/Value_definition_syntax">Sintaxe formal</a>: <code class="language-html">[<span class="tag token"><span class="tag token"><span class="punctuation token"><</span>length</span><span class="punctuation token">></span></span> | <span class="tag token"><span class="tag token"><span class="punctuation token"><</span>percentage</span><span class="punctuation token">></span></span>] && [border-box | content-box]? | available | min-content | max-content | fit-content | complex | auto</code>
</pre>
<pre>height: auto /* auto keyword */
height: 120px /* <length> values */
height: 10em
height: 75% /* <percentage> values */
height: inherit
</pre>
<h3 id="Values" name="Values">Valores</h3>
<dl>
<dt><code style="font-size: 14px;"><length></code></dt>
<dd>Veja {{cssxref("<length>")}} para unidades disponíveis.</dd>
<dt><code style="font-size: 14px;"><percentage></code></dt>
<dd>Especificada como uma {{cssxref("<percentage>")}} da altura do conteúdo do bloco.</dd>
<dt><code style="font-size: 14px;">border-box </code>{{ experimental_inline }}</dt>
<dd>Se presente, o último {{cssxref("<length>")}} ou {{cssxref("<percentage>")}} é aplicado a caixa de borda do elemento.</dd>
<dt><code style="font-size: 14px;">content-box</code> {{ experimental_inline }}</dt>
<dd>Se presente, o último {{cssxref("<length>")}} ou {{cssxref("<percentage>")}} é aplicado a caixa de conteúdo do elemento.</dd>
<dt><code style="font-size: 14px;">auto</code></dt>
<dd>O navegador calculará a altura do conteúdo especificado.</dd>
<dt><code style="font-size: 14px;">max-content</code> {{ experimental_inline }}</dt>
<dd>A altura máxima intrínseca.</dd>
<dt><code style="font-size: 14px;">min-content</code> {{ experimental_inline }}</dt>
<dd>A altura mínima intrínseca.</dd>
<dt><code style="font-size: 14px;">available</code> {{ experimental_inline }}</dt>
<dd>Altura da caixa menos margem vertical, borda e padding.</dd>
<dt><code style="font-size: 14px;">fit-content</code> {{ experimental_inline }}</dt>
<dd>O maior de:
<ul>
<li>a altura mínima intrínseca</li>
<li>a menor entre a altura intrínseca preferida e a altura disponível</li>
</ul>
</dd>
</dl>
<h2 id="Exemplos">Exemplos</h2>
<h3 id="HTML">HTML</h3>
<pre class="brush: html"><div id="red">
<span>I'm 50 pixels tall.</span>
</div>
<div id="green">
<span>I'm 25 pixels tall.</span>
</div>
<div id="parent">
<div id="child">
<span>I'm half the height of my parent.</span>
</div>
</div>
</pre>
<h3 id="CSS">CSS</h3>
<pre class="brush: css">div {
width: 250px;
margin-bottom: 5px;
border: 3px solid #999999;
}
#red {
height: 50px;
}
#green {
height: 25px;
}
#parent {
height: 100px;
}
#child {
height: 50%;
width: 75%;
}
</pre>
<p>{{EmbedLiveSample('Exemplos')}}</p>
<h2 id="Especificações">Especificações</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('CSS3 Box', '#the-width-and-height-properties', 'height')}}</td>
<td>{{Spec2('CSS3 Box')}}</td>
<td>Added the <code>max-content</code>, <code>min-content</code>, <code>available</code>, <code>fit-content</code>, <code>border-box</code>, <code>content-box</code> keywords.</td>
</tr>
<tr>
<td>{{SpecName('CSS3 Transitions', '#animatable-css', 'height')}}</td>
<td>{{Spec2('CSS3 Transitions')}}</td>
<td>Lists <code>height</code> as animatable.</td>
</tr>
<tr>
<td>{{SpecName('CSS2.1', 'visudet.html#the-height-property', 'height')}}</td>
<td>{{Spec2('CSS2.1')}}</td>
<td>Adds support for the {{cssxref("<length>")}} values and precises on which element it applies to.</td>
</tr>
<tr>
<td>{{SpecName('CSS1', '#height', 'height')}}</td>
<td>{{Spec2('CSS1')}}</td>
<td>Initial specification.</td>
</tr>
</tbody>
</table>
<h2 id="Compatibilidade_entre_navegadores">Compatibilidade entre navegadores</h2>
<p>{{CompatibilityTable()}}</p>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Chrome</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari</th>
</tr>
<tr>
<td>Suporte básico</td>
<td>1.0</td>
<td>{{CompatGeckoDesktop("1")}}</td>
<td>4.0</td>
<td>7.0</td>
<td>1.0</td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Android</th>
<th>Firefox Mobile (Gecko)</th>
<th>IE Phone</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
</tr>
<tr>
<td>Suporte básico</td>
<td>1.0</td>
<td>{{CompatGeckoMobile("1")}}</td>
<td>6.0</td>
<td>6.0</td>
<td>1.0</td>
</tr>
</tbody>
</table>
</div>
<h2 id="See_also" name="See_also">Veja também</h2>
<ul>
<li><a href="/en-US/docs/CSS/box_model" title="CSS/box_model">box model</a>, {{Cssxref("width")}}, {{Cssxref("box-sizing")}}, {{Cssxref("min-height")}}, {{Cssxref("max-height")}}</li>
</ul>
|