Container properties âstart & end
Flex container
Flex item Flex item
flex-direction: row;
Main axis
Cross axis
Main axis start Main axis end
Cross axis start
Cross axis end
15.
Flex container
Flex item
Flexitem
Cross axis
Main axis
Cross axis start Cross axis end
Main axis start
Main axis end
flex-direction: column;
Flex item alignment
.container{â¨
display: flex;â¨
align-items: flex-start; //no more stretching to fill the spaceâ¨
}
28.
Flex item alignment
.container{â¨
display: flex;â¨
align-items: flex-start; //no more stretching to fill the spaceâ¨
}â¨
.slds-align-middle {â¨
align-self: center; // This overrides the align-items propertyâ¨
}
29.
Flex item alignment
.container{â¨
display: flex;â¨
align-items: flex-start; //no more stretching to fill the spaceâ¨
}â¨
.slds-align-middle {â¨
align-self: center; // This overrides the align-items propertyâ¨
}
Media object
.media {â¨
display:flex;â¨
align-items: flex-start; // start at the top instead of stretchâ¨
}
.media__figure {â¨
flex-shrink: 0; // maintains the integrity of the attached mediaâ¨
}
.media__body {â¨
flex: 1; // takes up the remaining spaceâ¨
min-width: 0; // Allows truncation inside flexbox due to changes in
flex basisâ¨
}
35.
Media object
.media {â¨
display:flex;â¨
align-items: flex-start; // start at the top instead of stretchâ¨
}
.media__figure {â¨
flex-shrink: 0; // maintains the integrity of the attached mediaâ¨
}
.media__body {â¨
flex: 1; // takes up the remaining spaceâ¨
min-width: 0; // Allows truncation inside flexbox due to changes in
flex basisâ¨
}
Auto margin -vertical
.container {â¨
display: flex;â¨
flex-direction: column; // stack the flex-items upâ¨
align-items: center; // align to center on columnâs main axisâ¨
}
.col--bump-top { // bump classes come from our grid systemâ¨
margin-top: auto;â¨
}
45.
Auto margin -vertical
.container {â¨
display: flex;â¨
flex-direction: column; // stack the flex-items upâ¨
align-items: center; // align to center on columnâs main axisâ¨
}
.col--bump-top { // bump classes come from our grid systemâ¨
margin-top: auto;â¨
}
Resources
A Complete Guideto Flexbox - CSS Tricks
Known Bugs and Workarounds for Flexbox â Phil Walton
Flexbox froggy game
Anything by Zoe Gillenwater if you need to do progressive enhancement
Flexbox tester - Understand how to calculate the width of flex items
Almost complete guide to flexbox (without flexbox)
Visual Flexbox builder for Webflow
Flexbox Spec from W3C
Salesforce Lightning Design System - Grids
Smashing Magazine- the flexbox reading list