Styl flex Property
Příklad
Nechte všechny flexibilní položky mít stejnou délku bez ohledu na jejich obsah:
for (i = 0; i
y[i].style.flex = "1";
}
Definice a použití
Vlastnost flex nastavuje nebo vrací délku položky vzhledem ke zbytku flexibilních položek ve stejném kontejneru.
Vlastnost flex je zkratka pro vlastnosti flexGrow, flexShrink a flexBasis.
Poznámka: Pokud prvek není flexibilní položka, vlastnost flex nemá žádný vliv.
Podpora prohlížeče
Property | |||||
---|---|---|---|---|---|
flex | Yes | 11.0 10.0 msFlex |
Yes | 9.0 | Yes |
Syntax
Vraťte vlastnost flex:
object.style.flex
Nastavte vlastnost flex:
object.style.flex = "flex-grow flex-shrink flex-basis|auto|initial|inherit"
Hodnoty vlastností
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 |
Technické údaje
Výchozí hodnota: | 0 1 auto |
---|---|
Návratová hodnota: | Řetězec představující vlastnost flex prvku |
Verze CSS | CSS3 |
Související stránky
CSS reference: vlastnost flex
Odkaz na STYL DOM HTML: vlastnost flexBasis
HTML DOM STYLE Reference: vlastnost flexDirection
Odkaz na STYL DOM HTML: vlastnost flexFlow
HTML DOM STYLE Reference: vlastnost flexGrow
Odkaz na STYL DOM HTML: vlastnost flexShrink
Odkaz na STYL DOM HTML: vlastnost flexWrap
❮ Objekt stylu