The flex property in CSS is the combination of flex-grow, flex-shrink, and flex-basis property. It is used to set the length of flexible items. The flex property is much responsive and mobile friendly. It is easy to positioning child elements and the main container.
The margin doesn’t collapse with the content margins. Order of any element can be easily changed without editing the HTML section. But few times we have an unequal width of the element also that time you can design the whole things in the CSS section.
Note: Elements width depend on the other elements and screen of your window in this case.
Example 1: Here you will see the two types of width flexbox is design by using CSS.
Example 2: In this example you will see 4 items each of them having unequal width compare to each other.
- How to set space between the flexbox ?
- Advance CSS layout with flexbox
- Flexbox utilities in bootstrap with examples
- How to make flexbox children 100% height of their parent using CSS?
- How to vertically and horizontally align flexbox to center ?
- How to vertically align text inside a flexbox using CSS?
- CSS | Height and Width
- CSS | max-width Property
- CSS | min-width Property
- p5.js | width variable
- HTML | <pre> width Attribute
- CSS | outline-width Property
- HTML | <td> width Attribute
- HTML | DOM HR width Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.