flex是flex溉卓, flex-grow皮迟,flex-shrink, flex-basis 的縮寫形式:
flex-grow(默認(rèn)為0)搬泥,
flex-shrink(默認(rèn)為1),
flex-basis (默認(rèn)為auto)
如:flex 取值為 none,則計(jì)算值為 0 0 auto万栅,如下是等同的:
.item {flex: none;}
.item {
flex-grow: 0;
flex-shrink: 0;
flex-basis: auto;
}
當(dāng) flex取值為 auto佑钾,則計(jì)算值為 1 1 auto西疤,如下是等同的:
.item {flex: auto;}
.item {
flex-grow: 1;
flex-shrink: 1;
flex-basis: auto;
}
當(dāng) flex 取值為一個(gè)非負(fù)數(shù)字烦粒,則該數(shù)字為 flex-grow 值,flex-shrink 取 1代赁,flex-basis 取 0%扰她,如下是等同的:
.item {flex: 1;}
.item {flex-grow: 1; flex-shrink: 1; flex-basis: 0%;}
當(dāng) flex 取值為一個(gè)長(zhǎng)度或百分比,則視為 flex-basis 值芭碍,flex-grow 取 1徒役,flex-shrink取 1,有如下等同情況(注意 0% 是一個(gè)百分比而不是一個(gè)非負(fù)數(shù)字):
.item-1 {flex: 0%;}
.item-1 { flex-grow: 1; flex-shrink: 1; flex-basis: 0%;}
當(dāng) flex取值為兩個(gè)非負(fù)數(shù)字窖壕,則分別視為 flex-grow和 flex-shrink的值忧勿,flex-basis取 0%,如下是等同的:
.item {flex: 2 3;}
.item { flex-grow: 2; flex-shrink: 3; flex-basis: 0%;}