min-width
Baseline Widely available *
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
* Some parts of this feature may have varying levels of support.
尝试一下
语法
css
/* 值 */
min-width: 3.5em;
/* 值 */
min-width: 10%;
/* 关键字值 */
min-width: max-content;
min-width: min-content;
min-width: fit-content;
min-width: fit-content(20em);
/* 全局值 */
min-width: inherit;
min-width: initial;
min-width: revert;
min-width: revert-layer;
min-width: unset;
值
-
以绝对值定义
min-width
。 -
以包含区块的宽度百分比定义
min-width
。 auto
-
浏览器将计算并选择指定元素的
min-width
。 max-content
实验性-
固有首选
min-width
。 min-content
实验性-
固有最小
min-width
。 fit-content
-
使用可用空间,但不得超过 max-content,即
min(max-content,max(min-content,stretch))
。 fit-content(
实验性
)-
使用
fit-content
公式,用指定参数替换可用空间,即min(max-content, max(min-content, argument))
。
形式定义
形式语法
示例
设置元素最小宽度
css
table {
min-width: 75%;
}
form {
min-width: 0;
}
规范
Specification |
---|
CSS Box Sizing Module Level 3 # min-size-properties |
CSS Box Sizing Module Level 4 # sizing-values |