Skip to content

Instantly share code, notes, and snippets.

@bradyclifford
Last active October 7, 2022 02:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bradyclifford/1f5bd737a1a85ba399e5c3b3abbd7edf to your computer and use it in GitHub Desktop.
Save bradyclifford/1f5bd737a1a85ba399e5c3b3abbd7edf to your computer and use it in GitHub Desktop.
Layout Examples
// https://css-tricks.com/quick-whats-the-difference-between-flexbox-and-grid/
const Tile = styled.aside`
padding: 25px;
border: 2px solid #e4e4e4;
border-radius: 5px;
`;
// Flex
// https://css-tricks.com/snippets/css/a-guide-to-flexbox/#aa-background
const TileContainer = styled.section`
display: flex;
flex-flow: row wrap;
gap: 25px;
// With flex you have to set config on the children
>* {
flex: 1 400px; // don't wrap till min of 400px is hit
}
`;
// Grid - set config at the container level
// https://css-tricks.com/snippets/css/complete-guide-grid/#aa-introduction
const TileContainer = styled.section`
display: grid;
column-gap: 25px;
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
row-gap: 0.5em;
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment