Careeroza
Flex Items
flex-grow, flex-shrink, flex-basis
| Property | Meaning |
|---|---|
flex-grow | share of the free space the item takes (0 = do not grow) |
flex-shrink | how much it shrinks when space is short (0 = never shrink) |
flex-basis | starting size before growing/shrinking |
flex: 1 | shorthand: grow 1, shrink 1, basis 0: equal columns |
align-self | override align-items for one item |
order | visual order (does not change reading order for screen readers) |
Example
Example
The middle item takes twice as much free space as the others; the last one is fixed at 100px:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<style>
.container { display: flex; gap: 8px; }
.container > div { background: #04AA6D; color: white; padding: 10px 16px; font: 15px Arial; }
.a { flex: 1; }
.b { flex: 2; }
.c { flex: 0 0 100px; }
</style>
</head>
<body>
<div class="container"><div class="a">flex: 1</div><div class="b">flex: 2</div><div class="c">100px</div></div>
</body>
</html>Result