Junior
Wie ändert man die Richtung der Achse des Flexbox-Containers?
sobes.tech KI
Antwort von AI
Mit der CSS-Eigenschaft flex-direction.
/* Legt die Hauptrichtung von links nach rechts fest */
.container {
display: flex;
flex-direction: row;
}
/* Legt die Hauptrichtung von rechts nach links fest */
.container {
display: flex;
flex-direction: row-reverse;
}
/* Legt die Hauptrichtung von oben nach unten fest */
.container {
display: flex;
flex-direction: column;
}
/* Legt die Hauptrichtung von unten nach oben fest */
.container {
display: flex;
flex-direction: column-reverse;
}
| Wert | Beschreibung |
|---|---|
row |
Hauptrichtung von links nach rechts (Standard) |
row-reverse |
Hauptrichtung von rechts nach links |
column |
Hauptrichtung von oben nach unten |
column-reverse |
Hauptrichtung von unten nach oben |