+ 1

Flexbox in css?

What is the purpose of a flexbox is Css?

21st Apr 2022, 11:47 AM
Captain Coder(HARSH)
Captain Coder(HARSH) - avatar
2 Réponses
+ 2
Well, in CSS everything is a box and you can make boxes have a certain size or color etc. CSS also defines certain "display modes" which are used to move boxes around. The oldest and most common ones are "block" and "inline" which work fine most of the time. "flexbox" is relatively new to CSS and it makes it easier to position boxes inside of other boxes. For example, with flexbox you can easily have 5 boxes next to each other in a column layout. You can take an image and perfectly center it on the page with 3 lines of CSS. You can have 2 boxes on top of each other such that the first box is 100 pixels high, and the other gets the rest of the available space. All of this was possible before flexbox (possibly with the help of javascript), but flexbox makes it a lot easier.
21st Apr 2022, 2:47 PM
Schindlabua
Schindlabua - avatar
+ 2
Flexbox is like a grid but with one dimension, it allows you to let the items flow in a specific custom pattern compared to the traditional automatic placement.
21st Apr 2022, 3:27 PM
Valen.H. ~
Valen.H. ~ - avatar