DEV Community

Prerna Sharma
Prerna Sharma

Posted on

8 4 1 1 1

CSS-Flexbox

What is Flexbox?

Flexible Box Layout (Flexbox) is a CSS3 web layout model. The flex layout allows responsive elements within a container to be automatically arranged depending upon screen size.Flexbox consists of Flexbox Container and Flex items

Flex-Container

The outer box, which contains flex-items, is created using display: flex;

.flexbox {
display: flex
}
Enter fullscreen mode Exit fullscreen mode

This defines a flex container; inline or block depending on the given value. It enables a flex context for all its direct children.

Flex-Items

Direct children of the flex container

Flex-Direction

Column

Image description

.flexbox {
 flex-direction: column;
}
Enter fullscreen mode Exit fullscreen mode

Row

Image description

.flexbox {
 flex-direction: row;
}
Enter fullscreen mode Exit fullscreen mode

Column-reverse

Image description

.flexbox {
 flex-direction: column-reverse;
}
Enter fullscreen mode Exit fullscreen mode

Row-reverse

Image description

.flexbox {
 flex-direction: row-reverse;
}
Enter fullscreen mode Exit fullscreen mode

Justify-Content

Space-between

Image description

.flexbox {
 justify-content: space-between;
}
Enter fullscreen mode Exit fullscreen mode

Space-Evenly

Image description

.flexbox {
 justify-content: space-evenly;
}
Enter fullscreen mode Exit fullscreen mode

Space-around

Image description

.flexbox {
 justify-content: space-around;
}
Enter fullscreen mode Exit fullscreen mode

Align Items

Center

Image description

.flexbox {
 align-items: center;
}
Enter fullscreen mode Exit fullscreen mode

Flex-start

Image description

.flexbox {
 align-items: flex-start;
}
Enter fullscreen mode Exit fullscreen mode

Flex-end

Image description

.flexbox {
 align-items: flex-end;
}
Enter fullscreen mode Exit fullscreen mode

Flex-Wrap Properties

Nowrap

Image description

.flexbox {
  flex-wrap: nowrap;
}
Enter fullscreen mode Exit fullscreen mode

Wrap

Image description

.flexbox {
 flex-wrap: wrap;
}
Enter fullscreen mode Exit fullscreen mode

Wrap-reverse

Image description

.flexbox {
  flex-wrap: wrap-reverse;
}
Enter fullscreen mode Exit fullscreen mode

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (1)

Collapse
 
joelbonetr profile image
JoelBonetR πŸ₯‡ β€’

It has been funny to read, thank you for sharing! 😁

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay