min-inline-size
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2021.
CSS 属性 min-inline-size
根据元素的书写模式定义了元素区块的横向或纵向最小尺寸。根据 writing-mode
的值,此属性对应于 min-width
或 min-height
属性。
尝试一下
语法
css
/* <length> 值 */
min-inline-size: 100px;
min-inline-size: 5em;
/* <percentage> 值 */
min-inline-size: 10%;
/* 关键词值 */
min-inline-size: max-content;
min-inline-size: min-content;
min-inline-size: fit-content(20em);
/* 全局值 */
min-inline-size: inherit;
min-inline-size: initial;
min-inline-size: revert;
min-inline-size: revert-layer;
min-inline-size: unset;
若为纵向书写模式,则 min-inline-size
的值对应于元素的最小高度;否则对应于元素的最小宽度。与此相关的属性为 min-block-size
,此属性定义了元素另一方向的尺度。
取值
min-inline-size
属性的取值与 min-width
和 min-height
属性相同。
形式定义
初始值 | 0 |
---|---|
适用元素 | same as width and height |
是否是继承属性 | 否 |
Percentages | inline-size of containing block |
计算值 | same as min-width and min-height |
动画类型 | a length, percentage or calc(); |
形式语法
min-inline-size =
<'min-width'>
<min-width> =
auto |
<length-percentage [0,∞]> |
min-content |
max-content |
fit-content( <length-percentage [0,∞]> ) |
<calc-size()> |
<anchor-size()>
<length-percentage> =
<length> |
<percentage>
<calc-size()> =
calc-size( <calc-size-basis> , <calc-sum> )
<anchor-size()> =
anchor-size( [ <anchor-element> || <anchor-size> ]? , <length-percentage>? )
<calc-size-basis> =
<intrinsic-size-keyword> |
<calc-size()> |
any |
<calc-sum>
<calc-sum> =
<calc-product> [ [ '+' | '-' ] <calc-product> ]*
<anchor-element> =
<dashed-ident>
<anchor-size> =
width |
height |
block |
inline |
self-block |
self-inline
<calc-product> =
<calc-value> [ [ '*' | '/' ] <calc-value> ]*
<calc-value> =
<number> |
<dimension> |
<percentage> |
<calc-keyword> |
( <calc-sum> )
<calc-keyword> =
e |
pi |
infinity |
-infinity |
NaN
示例
为竖排文本设置最小行向尺寸
HTML
html
<p class="exampleText">示例文本</p>
CSS
css
.exampleText {
writing-mode: vertical-rl;
background-color: yellow;
block-size: 5%;
min-inline-size: 200px;
}
结果
规范
Specification |
---|
CSS Logical Properties and Values Level 1 # propdef-min-inline-size |
CSS Box Sizing Module Level 4 # sizing-values |
浏览器兼容性
BCD tables only load in the browser
参见
- 对应的实体属性:
min-width
和min-height
writing-mode