Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Axes in Flexbox | Understanding Flexbox Basics
CSS Flexbox Foundations

bookAxes in Flexbox

To use Flexbox effectively for layout, you first need to understand its two fundamental axes: the main axis and the cross axis. In Flexbox, the main axis is the direction in which flex items are laid out by default. This direction is controlled by the flex-direction property. The cross axis is always perpendicular to the main axis. If you think of the main axis as a road, the cross axis would be the street that crosses it. The way your items are arranged—either in a row (horizontally) or a column (vertically)—depends on which axis is set as the main axis.

index.html

index.html

copy

In the example above, the container uses display: flex with flex-direction: row. This means the main axis runs horizontally, from left to right. The flex items (A, B, C) are arranged in a row along this axis. The cross axis is vertical, running from top to bottom.

If you change the flex-direction to column, the axes swap: the main axis becomes vertical and the cross axis becomes horizontal. This simple switch completely changes the flow of your layout.

index.html

index.html

copy
question mark

Which of the following statements about Flexbox axes and flex-direction are correct?

Select the correct answer

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 2

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

Awesome!

Completion rate improved to 7.69

bookAxes in Flexbox

Desliza para mostrar el menú

To use Flexbox effectively for layout, you first need to understand its two fundamental axes: the main axis and the cross axis. In Flexbox, the main axis is the direction in which flex items are laid out by default. This direction is controlled by the flex-direction property. The cross axis is always perpendicular to the main axis. If you think of the main axis as a road, the cross axis would be the street that crosses it. The way your items are arranged—either in a row (horizontally) or a column (vertically)—depends on which axis is set as the main axis.

index.html

index.html

copy

In the example above, the container uses display: flex with flex-direction: row. This means the main axis runs horizontally, from left to right. The flex items (A, B, C) are arranged in a row along this axis. The cross axis is vertical, running from top to bottom.

If you change the flex-direction to column, the axes swap: the main axis becomes vertical and the cross axis becomes horizontal. This simple switch completely changes the flow of your layout.

index.html

index.html

copy
question mark

Which of the following statements about Flexbox axes and flex-direction are correct?

Select the correct answer

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 2
some-alt