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-width/index.html | |
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-width/index.html')
-rw-r--r-- | files/zh-cn/web/css/min-width/index.html | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/min-width/index.html b/files/zh-cn/web/css/min-width/index.html new file mode 100644 index 0000000000..89e565f074 --- /dev/null +++ b/files/zh-cn/web/css/min-width/index.html @@ -0,0 +1,111 @@ +--- +title: min-width +slug: Web/CSS/min-width +translation_of: Web/CSS/min-width +--- +<p>{{ CSSRef() }}</p> + +<h2 id="概述">概述</h2> + +<p><code>min-width</code> 属性为给定元素设置最小宽度。它可以阻止 {{ Cssxref("width") }} 属性的应用值小于 <code>min-width</code> 的值。</p> + +<p><code>min-width 的值会同时覆盖</code> {{ Cssxref("max-width") }} 和 {{ Cssxref("width") }}。</p> + +<h2 id="语法">语法</h2> + +<pre class="twopartsyntaxbox"><a href="/en-US/docs/CSS/Value_definition_syntax" title="CSS/Value_definition_syntax">形式语法:</a> {{csssyntax("min-width")}}</pre> + +<pre>/* <length> value */ +min-width: 3.5em + +/* <percentage> value */ +min-width: 10% + +/* Keyword values */ +min-width: max-content +min-width: min-content +min-width: fit-content +min-width: fill-available + +/* Global values */ +min-width: inherit +min-width: initial +min-width: unset +</pre> + +<h3 id="值">值</h3> + +<dl> + <dt><code><length></code></dt> + <dd>固定的最小宽度。 查看 {{cssxref("<length>")}} 了解可用单位。负值会让该声明失效。</dd> + <dt><code><percentage></code></dt> + <dd>固定的最小宽度表现为包含块宽度的 {{cssxref("<percentage>")}} (百分比值)。负值会让该声明失效。</dd> +</dl> + +<h4 id="Keyword_values">Keyword values</h4> + +<dl> + <dt><code>auto</code></dt> + <dd>用于弹性元素的默认最小宽度。相比其他布局中以<code>0</code>为默认值,<code>auto</code>能为弹性布局指明更合理的默认表现。</dd> + <dt><code>max-content</code> {{ experimental_inline() }}</dt> + <dd>固有首选宽度。</dd> + <dt><code>min-content</code> {{ experimental_inline() }}</dt> + <dd>固有最小宽度</dd> + <dt><code>fill-available</code>{{ experimental_inline() }}</dt> + <dd>包含块的宽度减去水平 margin、border 和 padding。有些浏览器在实现时使用了该关键字的早期名字: <code>available</code>。</dd> + <dt><code>fit-content</code> {{ experimental_inline() }}</dt> + <dd>等同于 <code>min(max-content, max(min-content, fill-available)</code>.</dd> +</dl> + +<h2 id="示例">示例</h2> + +<pre class="brush:css;">table { min-width: 75%; } + +form { min-width: 0; } +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{ SpecName('CSS3 Sizing', '#width-height-keywords', 'min-width') }}</td> + <td>{{ Spec2('CSS3 Sizing') }}</td> + <td>增加 <code>max-content</code>, <code>min-content</code>, <code>fit-content</code>, 和<code> fill-available</code> 关键字。<br> + <em>CSS3 Box 与 CSS3 Writing Modes 两份草案在某种程度上定义了这些关键字。本草案取代了这些草案。</em></td> + </tr> + <tr> + <td>{{ SpecName('CSS3 Flexbox', '#min-auto', 'min-width') }}</td> + <td>{{ Spec2('CSS3 Flexbox') }}</td> + <td><a href="http://www.w3.org/TR/2012/CR-css3-flexbox-20120918/">早期的修订规范</a> 增加了 <code>auto</code> 关键字并将其作为初始值。然而 CSSWG 随后重置了这一变更。直至2013 年 3月 29日,最新的 <a href="http://dev.w3.org/csswg/css-flexbox/">编辑草案</a> 没有对<code> min-width</code> 属性做任何修改(也就是说 <code>auto 值已经不被推荐</code>)。</td> + </tr> + <tr> + <td>{{ SpecName('CSS3 Transitions', '#animatable-css', 'min-width') }}</td> + <td>{{ Spec2('CSS3 Transitions') }}</td> + <td>定义 <code>min-width</code> 为动画属性。</td> + </tr> + <tr> + <td>{{ SpecName('CSS2.1', 'visudet.html#min-max-widths', 'min-width') }}</td> + <td>{{ Spec2('CSS2.1') }}</td> + <td>初始定义。</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2> + +<p>{{Compat("css.properties.min-width")}}</p> + +<div id="compat-mobile"></div> + +<h2 id="See_also">See also</h2> + +<ul> + <li>{{ Cssxref("width") }}, {{ Cssxref("max-width") }}, {{ Cssxref("min-height") }}</li> + <li>The <a href="/en-US/docs/CSS/box_model" title="en/CSS/box_model">box model</a>, {{ Cssxref("box-sizing") }}</li> +</ul> |