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
|
---
title: height
slug: Web/CSS/height
tags:
- Propiedad CSS
- Referencia
translation_of: Web/CSS/height
---
<div>{{CSSRef}}</div>
<h2 id="Resumen">Resumen</h2>
<p>La propiedad CSS <strong><code>height</code></strong> especifica la altura del area de contenido de un elemento. El <a href="https://developer.mozilla.org/es/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model#content-area">área de contenido</a> está <em>dentro</em> del padding, borde, y margen del elemento.</p>
<p>Las propiedades {{cssxref("min-height")}} y {{cssxref("max-height")}} sobreescriben el valor de {{Cssxref("height")}}.</p>
<p>{{cssinfo}}</p>
<h2 id="Sintaxis">Sintaxis</h2>
<pre class="brush:css">/* Valores clave */
height: auto;
/* Valores <length> */
height: 120px;
height: 10em;
/* Valores <percentage> */
height: 75%;
/* Valores globales */
height: inherit;
height: initial;
height: unset;
</pre>
<h3 id="Valores">Valores</h3>
<dl>
<dt><code><length></code></dt>
<dd>Ver {{cssxref("<length>")}} para unidades disponibles.</dd>
<dt><code><percentage></code></dt>
<dd>Especificado con el tipo {{cssxref("<percentage>")}} como porcentaje de la altura del bloque contenedor</dd>
<dt><code>border-box </code>{{experimental_inline}}</dt>
<dd>Si está presente, el valor {{cssxref("<length>")}} o {{cssxref("<percentage>")}} precedente es aplicado a los límites del borde del elemento.</dd>
<dt><code>content-box</code> {{experimental_inline}}</dt>
<dd>Si está presente, el valor {{cssxref("<length>")}} o {{cssxref("<percentage>")}} precedente será aplicado a los límites de contenido del elemento.</dd>
<dt><code>auto</code></dt>
<dd>El navegador calculará y seleccionará la altura para el elemento especificado.</dd>
<dt>fill {{experimental_inline}}</dt>
<dd>Use el tamaño <code>fill-available</code> para elementos inline o block, según sea más apropiado para el modo de escritura.</dd>
<dt><code>max-content</code> {{experimental_inline}}</dt>
<dd>La altura preferida intrínseca.</dd>
<dt><code>min-content</code> {{experimental_inline}}</dt>
<dd>La altura mínima intrínseca.</dd>
<dt><code>available</code> {{experimental_inline}}</dt>
<dd>La altura del bloque contenedor menos su margen vertical, borde y padding.</dd>
<dt><code>fit-content</code> {{experimental_inline}}</dt>
<dd>El mayor entre:
<ul>
<li>la altura mínima intrínseca</li>
<li>la menor entre la altura prefereida intrínseca y la altura disponible</li>
</ul>
</dd>
</dl>
<h3 id="Sintaxis_formal">Sintaxis formal</h3>
{{csssyntax}}
<h2 id="Ejemplo">Ejemplo</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('Example')}}</p>
<h2 id="Especificaciones">Especificaciones</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Especificación</th>
<th scope="col">Estado</th>
<th scope="col">Comentarios</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('CSS3 Box', '#the-width-and-height-properties', 'height')}}</td>
<td>{{Spec2('CSS3 Box')}}</td>
<td>Añade las palabras clave <code>max-content</code>, <code>min-content</code>, <code>available</code>, <code>fit-content</code>, <code>border-box</code>, <code>content-box</code>.</td>
</tr>
<tr>
<td>{{SpecName('CSS3 Transitions', '#animatable-css', 'height')}}</td>
<td>{{Spec2('CSS3 Transitions')}}</td>
<td>Incluye <code>height</code> como propiedad que puede ser animada.</td>
</tr>
<tr>
<td>{{SpecName('CSS2.1', 'visudet.html#the-height-property', 'height')}}</td>
<td>{{Spec2('CSS2.1')}}</td>
<td>Añade soporte para valores {{cssxref("<length>")}} y especifica a qué elementos es aplicable.</td>
</tr>
<tr>
<td>{{SpecName('CSS1', '#height', 'height')}}</td>
<td>{{Spec2('CSS1')}}</td>
<td>Definición inicial</td>
</tr>
<tr>
<td>{{SpecName('CSS3 Sizing', '#width-height-keywords', 'width')}}</td>
<td>{{Spec2('CSS3 Sizing')}}</td>
<td>Añade nuevas palabras clave de tamaño para <code>width</code> y <code>height</code></td>
</tr>
</tbody>
</table>
<h2 id="Compatibilidad_de_navegadores">Compatibilidad de navegadores</h2>
{{Compat("css.properties.height")}}
<h2 id="Véase_también">Véase también</h2>
<ul>
<li><a href="/es/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model">box model</a>, {{cssxref("width")}}, {{cssxref("box-sizing")}}, {{cssxref("min-height")}}, {{cssxref("max-height")}}</li>
</ul>
|