Propriété flexible de style
Exemple
Laissez tous les éléments flexibles avoir la même longueur, quel que soit leur contenu :
for (i = 0; i
y[i].style.flex = "1";
}
Définition et utilisation
La propriété flex définit ou renvoie la longueur de l'élément, par rapport au reste des éléments flexibles à l'intérieur du même conteneur.
La propriété flex est un raccourci pour les propriétés flexGrow, flexShrink et flexBasis.
Remarque : Si l'élément n'est pas un élément flexible, la propriété flex n'a aucun effet.
Prise en charge du navigateur
Property | |||||
---|---|---|---|---|---|
flex | Yes | 11.0 10.0 msFlex |
Yes | 9.0 | Yes |
Syntaxe
Renvoyez la propriété flex :
object.style.flex
Définissez la propriété flex :
object.style.flex = "flex-grow flex-shrink flex-basis|auto|initial|inherit"
Valeurs de propriété
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 |
Détails techniques
Valeur par défaut: | 0 1 automatique |
---|---|
Valeur de retour : | Une chaîne, représentant la propriété flex d'un élément |
Version CSS | CSS3 |
Pages connexes
Référence CSS : propriété flex
Référence HTML DOM STYLE : propriété flexBasis
Référence HTML DOM STYLE : propriété flexDirection
Référence HTML DOM STYLE : propriété flexFlow
Référence HTML DOM STYLE : propriété flexGrow
Référence HTML DOM STYLE : propriété flexShrink
Référence HTML DOM STYLE : propriété flexWrap
❮ Objet de style