diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/min-height | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/css/min-height')
-rw-r--r-- | files/zh-cn/web/css/min-height/index.html | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/min-height/index.html b/files/zh-cn/web/css/min-height/index.html new file mode 100644 index 0000000000..29775ae7f5 --- /dev/null +++ b/files/zh-cn/web/css/min-height/index.html @@ -0,0 +1,111 @@ +--- +title: min-height +slug: Web/CSS/min-height +translation_of: Web/CSS/min-height +--- +<div>{{CSSRef}}</div> + +<p>CSS 属性 <code><strong>min-height</strong></code> 能够设置元素的最小高度。这样能够防止 <code>{{cssxref("height")}}</code> 属性的<a href="/zh-CN/docs/Web/CSS/used_value">应用值</a>小于 <code>min-height</code> 的值。</p> + +<div>{{EmbedInteractiveExample("pages/css/min-height.html")}}</div> + +<div class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> and send us a pull request.</div> + +<p>当 <code>min-height</code> 大于 {{cssxref("max-height")}} 或 {{cssxref("height")}} 时,元素的高度会设置为 <code>min-height</code> 的值。</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="brush:css no-line-numbers notranslate">/* <长度> 数值 */ +min-height: 3.5em; + +/* <百分比> 数值 */ +min-height: 10%; + +/* 关键词 */ +min-height: max-content; +min-height: min-content; +min-height: fit-content(20em); + +/* 全局数值 */ +min-height: inherit; +min-height: initial; +min-height: unset; +</pre> + +<h3 id="Values" name="Values">Values</h3> + +<dl> + <dt>{{cssxref("<length>")}}</dt> + <dd>定义 <code>min-height</code> 为一个绝对数值。</dd> + <dt>{{cssxref("<percentage>")}}</dt> + <dd>定义 <code>min-height</code> 为一个相对于父容器高度的百分数。</dd> + <dt><code>auto</code></dt> + <dd>浏览器将通过计算为指定元素选择一个 <code>min-height</code> 值。</dd> + <dt><code>none</code></dt> + <dd>不限制盒容器的尺寸。</dd> + <dt><code>max-content</code></dt> + <dd>The intrinsic preferred <code>min-height</code>.</dd> + <dt><code>min-content</code></dt> + <dd>The intrinsic minimum <code>min-height</code>.</dd> + <dt><code>fit-content({{cssxref("<length-percentage>")}})</code></dt> + <dd>Uses the <code>fit-content</code> formula with the available space replaced by the specified argument, i.e. <code>min(max-content, max(min-content, <var>argument</var>))</code>.</dd> +</dl> + +<h2 id="Formal_definition">Formal definition</h2> + +<p>{{cssinfo}}</p> + +<h2 id="Formal_syntax">Formal syntax</h2> + +<pre class="syntaxbox notranslate">{{csssyntax}}</pre> + +<h2 id="示例">示例</h2> + +<h3 id="Setting_min-height">Setting min-height</h3> + +<pre class="brush:css; notranslate">table { min-height: 75%; } + +form { min-height: 0; } +</pre> + +<h2 id="规范">规范</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('CSS4 Sizing', '#width-height-keywords', 'min-height')}}</td> + <td>{{Spec2('CSS4 Sizing')}}</td> + <td></td> + </tr> + <tr> + <td>{{SpecName('CSS3 Sizing', '#width-height-keywords', 'min-height')}}</td> + <td>{{Spec2('CSS3 Sizing')}}</td> + <td>Adds the <code>max-content</code>, <code>min-content</code>, <code>fit-content</code> keywords.</td> + </tr> + <tr> + <td>{{SpecName('CSS2.1', 'visudet.html#min-max-heights', 'min-height')}}</td> + <td>{{Spec2('CSS2.1')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + + + +<p>{{Compat("css.properties.min-height")}}</p> + +<h2 id="相关链接">相关链接</h2> + +<ul> + <li><a href="/en-US/docs/Web/CSS/CSS_Box_Model/Introduction_to_the_CSS_box_model">The box model</a>, {{cssxref("box-sizing")}}</li> + <li>{{cssxref("height")}}, {{cssxref("max-height")}}</li> +</ul> |