Trusted answers to developer questions

What is a CSS flexbox?

Get Started With Machine Learning

Learn the fundamentals of Machine Learning with this free course. Future-proof your career by adding ML skills to your toolkit — or prepare to land a job in AI or Data Science.

A flexbox provides powerful alignment options by giving the user control over properties like alignment, order, and direction.

Some terminology:

  • flex container: groups flex items together to control their representation.
  • flex items: direct children of the flex container.

Properties

There are six container properties:

  • flex-direction
  • flex-wrap
  • justify-content
  • align-items
  • flex-flow
  • align-content

Let’s see how each of these properties are used:

flex-direction

Determines the direction in which the items ne​ed to be placed.

flex-wrap

Defines if items should wrap or not.

justify-content

Aligns the items.

align-items

Aligns the items vertically.

flex-flow

Sets the flex-wrap and flex-direction together.

align-content

Aligns the flex lines.

To learn more, refer to the official documentation.

RELATED TAGS

css
flexbox
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?