flex 属性设置或返回项目相对于同一容器内其余灵活项目的长度。
flex 属性是 flexGrow、flexShrink 和 flexBasis 属性的简写。
笔记:如果元素不是弹性项,则 flex 属性不起作用。
Property | |||||
---|---|---|---|---|---|
flex | Yes | 11.0 | Yes | 9.0 | Yes |
返回 flex 属性:
object.style.flex
设置弹性属性:
object.style.flex = "
flex-grow
flex-shrink
flex-basis|auto|initial|inherit"
Value | Description |
---|---|
flex-grow | A number specifying how much the item will grow relative to the rest of the flexible items |
flex-shrink | A number specifying how much the item will shrink relative to the rest of the flexible items |
flex-basis | The length of the item. Legal values: "auto", "inherit", or a number followed by "%", "px", "em" or any other length unit |
auto | Same as 1 1 auto. |
initial | Same as 0 1 auto. Read about initial |
none | Same as 0 0 auto. |
inherit | Inherits this property from its parent element. Read about inherit |
默认值: | 0 1 自动 |
---|---|
返回值: | 一个字符串,表示元素的 flex 属性 |
CSS版本 | CSS3 |
CSS 参考:弹性属性
HTML DOM 样式参考:flexBasis 属性
HTML DOM 样式参考:flexDirection 属性
HTML DOM 样式参考:flexFlow 属性
HTML DOM 样式参考:flexGrow 属性
HTML DOM 样式参考:flexShrink 属性
HTML DOM 样式参考:flexWrap 属性
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!