Propriété CSS align-content
Exemple
Emballez les lignes vers le centre du conteneur flexible :
div
{
width: 70px;
height: 300px;
border: 1px solid #c3c3c3;
display: flex;
flex-wrap: wrap;
align-content: center;
}
Définition et utilisation
La align-content
propriété modifie le comportement de la
propriété flex-wrap . Il est similaire à
align-items , mais au lieu d'aligner les éléments flexibles, il aligne les lignes flexibles.
Remarque : Il doit y avoir plusieurs lignes d'éléments pour que cette propriété ait un effet !
Astuce : Utilisez la propriété justifier-content pour aligner les éléments sur l'axe principal (horizontalement).
Valeur par défaut: | s'étirer |
---|---|
Hérité: | non |
Animable : | non. En savoir plus sur l'animation |
Version: | CSS3 |
Syntaxe JavaScript : | objet .style.alignContent="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-content | 21.0 | 11.0 | 28.0 | 9.0 7.0 -webkit- |
12.1 |
Syntaxe CSS
align-content: stretch|center|flex-start|flex-end|space-between|space-around|initial|inherit;
Valeurs de propriété
Value | Description | Play it |
---|---|---|
stretch | Default value. Lines stretch to take up the remaining space | |
center | Lines are packed toward the center of the flex container | |
flex-start | Lines are packed toward the start of the flex container | |
flex-end | Lines are packed toward the end of the flex container | |
space-between | Lines are evenly distributed in the flex container | |
space-around | Lines are evenly distributed in the flex container, with half-size spaces on either end | |
space-evenly | Lines are evenly distributed in the flex container, with equal space around them | |
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-items
Référence CSS : propriété align-self
Référence CSS : propriété justifier-content
Référence HTML DOM : propriété alignContent