Have you failed a job interview?
Send us your job interview questions and get correct answers.

What is a cross axis in Flexbox?

Experience Level: Junior
Tags: CSSFlexbox

Answer

In Flexbox, the cross axis is an axis that is perpendicular to the main axis.

The flex-direction: row defines the direction of the main axis to be horizontal. The cross axis will then be vertical.

The flex-direction: column defines the direction of the main axis to be vertical. The cross axis will then be horizontal.

CSS

The cross axis for the following CSS will be vertical:

div {
  display: flex;
  flex-direction: row;
}

The cross axis for the following CSS will be horizontal:

div {
  display: flex;
  flex-direction: column;
}

Comments

No Comments Yet.
Be the first to tell us what you think.
Flexbox
Flexbox

Are you learning Flexbox ? Try our test we designed to help you progress faster.

Test yourself
25 Flexbox questions that will help you to nail your job interview
25 Flexbox questions that will help you to nail your job interview

Are you learning Flexbox ? Try our test we designed to help you progress faster.

Test yourself