English
width 属性用于设置元素的宽度。width 默认设置内容区域的宽度,但如果 box-sizing 属性被设置为 border-box,就转而设置边框区域的宽度。
width: auto | <length> | <percentage>;
fit-content
取以下两种值中的较大值:
固有的最小宽度
固有首选宽度(max-content)和可用宽度(available)两者中的较小值
可表示为:min(max-content, max(min-content, \<length-percentage>))
max-content
元素内容固有的(intrinsic)合适宽度。
min-content
元素内容固有的最小宽度。
| Platform | default |
|---|---|
| app-uvue | auto |
| web | auto |
| Android version | Android uni-app | Android uni-app-x | iOS version | iOS uni-app | iOS uni-app-x | |
|---|---|---|---|---|---|---|
| width | 5.0 | √ | 3.9+ | 9.0 | √ | - |
| fit-content | 5.0 | √ | x | 9.0 | √ | x |
| max-content | 5.0 | √ | x | 9.0 | √ | x |
| min-content | 5.0 | √ | x | 9.0 | √ | x |