Skip to content

Instantly share code, notes, and snippets.

@mafsdisseny
Created February 20, 2023 14:58
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 mafsdisseny/0899dd97d763cc9d71346f8b03dfcc3a to your computer and use it in GitHub Desktop.
Save mafsdisseny/0899dd97d763cc9d71346f8b03dfcc3a to your computer and use it in GitHub Desktop.
GeneratePress > Grids ||| Align last block (inside a container) to the bottom of the grid items
// SOURCE: https://community.generateblocks.com/t/grid-items-with-different-content-heights-aligned-bottom-block/36
//
// If you have grid items in a row with different height contents,
// you may want to pin the last block (a button, for example) to the bottom of the grid items
// so they all align in the row. This is a popular look with pricing tables, for example.
// As of right now, there is no option for this, but it can be done with some simple CSS.
// First, give your Container block a custom class: my-custom-class.
// Then, add the following CSS:
.my-custom-class .gb-inside-container {
display: flex;
flex-direction: column;
height: 100%;
}
.my-custom-class .gb-inside-container > *:last-child {
margin-top: auto;
}
// This will make sure the last block in the containers align across the row regardless of the content heights.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment