Junior
Comment changer la direction de l'axe du conteneur flexbox?
sobes.tech IA
Réponse de l'IA
À l'aide de la propriété CSS flex-direction.
/* Définit l'axe principal de gauche à droite */
.container {
display: flex;
flex-direction: row;
}
/* Définit l'axe principal de droite à gauche */
.container {
display: flex;
flex-direction: row-reverse;
}
/* Définit l'axe principal de haut en bas */
.container {
display: flex;
flex-direction: column;
}
/* Définit l'axe principal de bas en haut */
.container {
display: flex;
flex-direction: column-reverse;
}
| Valeur | Description |
|---|---|
row |
Axe principal de gauche à droite (par défaut) |
row-reverse |
Axe principal de droite à gauche |
column |
Axe principal de haut en bas |
column-reverse |
Axe principal de bas en haut |