Propriété alignSelf de style
Exemple
Définissez les alignements de l'un des éléments à l'intérieur d'un élément flexible pour qu'il s'adapte au conteneur :
document.getElementById("myBlueDiv").style.alignSelf = "stretch";
Définition et utilisation
La propriété alignSelf spécifie l'alignement de l'élément sélectionné à l'intérieur du conteneur flexible.
Remarque : La propriété alignSelf remplace la propriété alignItems du conteneur flexible.
Prise en charge du navigateur
Les nombres dans le tableau indiquent la première version du navigateur qui prend entièrement en charge la propriété.
Les nombres suivis de Webkit spécifient la première version qui a fonctionné avec un préfixe.
Property | |||||
---|---|---|---|---|---|
alignSelf | 21.0 | 11.0 | 20.0 | 9.0 7.0 Webkit |
12.1 |
Syntaxe
Renvoyez la propriété alignSelf :
object.style.alignSelf
Définissez la propriété alignSelf :
object.style.alignSelf = "auto|stretch|center|flex-start|flex-end|baseline|initial|inherit"
Valeurs de propriété
Value | Description |
---|---|
auto | Default. The element inherits its parent container's align-items property, or "stretch" if it has no parent container |
stretch | The element is positioned to fit the conatiner |
center | The element is positioned at the center of the container |
flex-start | The element is are positioned at the beginning of the container |
flex-end | The element is positioned at the end of the container |
baseline | The element is positioned at the baseline of the container |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Détails techniques
Valeur par défaut: | auto |
---|---|
Valeur de retour : | Une chaîne, représentant la propriété align-self d'un élément |
Version CSS | CSS3 |
Pages connexes
Référence CSS : propriété align-self
Référence HTML DOM STYLE : propriété alignContent
Référence HTML DOM STYLE : propriété alignItems