File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ and pairing with smart people at Hashrocket.
99
1010For a steady stream of TILs, [ sign up for my newsletter] ( https://tinyletter.com/jbranchaud ) .
1111
12- _ 879 TILs and counting..._
12+ _ 880 TILs and counting..._
1313
1414---
1515
@@ -99,6 +99,7 @@ _879 TILs and counting..._
9999- [ Circular Icons With A Massive Border Radius] ( css/circular-icons-with-a-massive-border-radius.md )
100100- [ Create A Pulsing Background With CSS Animation] ( css/create-a-pulsing-background-with-css-animation.md )
101101- [ Dry Up SCSS With Mixins] ( css/dry-up-scss-with-mixins.md )
102+ - [ Give Elements The Same Width With Flexbox] ( css/give-elements-the-same-width-with-flexbox.md )
102103- [ Lighten And Darken With CSS Brightness Filter] ( css/lighten-and-darken-with-css-brightness-filter.md )
103104- [ Lighten And Darken With SCSS] ( css/lighten-and-darken-with-scss.md )
104105- [ Make A Block Of Text Respect New Lines] ( css/make-a-block-of-text-respect-new-lines.md )
Original file line number Diff line number Diff line change 1+ # Give Elements The Same Width With Flexbox
2+
3+ By default, a row of elements in a basic flex container are going to have
4+ dynamic widths that accommodate their contents. This may not be desirable if
5+ you're going for a uniform look. You could give all child elements a fixed
6+ width (e.g. ` width: 100px ` ), but that loses out on the _ flexibility_ of a
7+ flexbox layout.
8+
9+ You can instead give all child elements a uniform and flexible width using the
10+ ` flex ` property.
11+
12+ ``` css
13+ .flex-container {
14+ display : flex ;
15+ }
16+
17+ .flex-child {
18+ flex : 1 ;
19+ }
20+ ```
21+
22+ This value is a relative ratio. If all children of the flex container have the
23+ same ` flex ` value (i.e. ` 1 ` ), then they will all be equally sized and that size
24+ will adjust as the width of the flex container changes.
25+
26+ [ source] ( https://css-tricks.com/the-thought-process-behind-a-flexbox-layout/ )
You can’t perform that action at this time.
0 commit comments