Propriété CSS align-items
Exemple
Centrez les alignements pour tous les éléments de l'élément flexible <div> :
div
{
display: flex;
align-items: center;
}
Définition et utilisation
La align-items
propriété spécifie l'alignement par défaut des éléments à l'intérieur du conteneur flexible.
Astuce : Utilisez la propriété align-self de chaque élément pour remplacer la align-items
propriété.
Valeur par défaut: | s'étirer |
---|---|
Hérité: | non |
Animable : | non. En savoir plus sur l'animation |
Version: | CSS3 |
Syntaxe JavaScript : | objet .style.alignItems="center" |
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 | |||||
---|---|---|---|---|---|
align-items | 21.0 | 11.0 | 20.0 | 9.0 7.0 -webkit- |
12.1 |
Syntaxe CSS
align-items: stretch|center|flex-start|flex-end|baseline|initial|inherit;
Valeurs de propriété
Value | Description | Play it |
---|---|---|
stretch | Default. Items are stretched to fit the container | |
center | Items are positioned at the center of the container | |
flex-start | Items are positioned at the beginning of the container | |
flex-end | Items are positioned at the end of the container | |
baseline | Items are 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 |
Pages connexes
Référence CSS : propriété align-content
Référence CSS : propriété align-self
Référence HTML DOM : propriété alignItems