How can I make div blocks fit the full length of a grid in Webflow and eliminate the grey space under the shorter ones?

Published on
September 22, 2023

To make div blocks fit the full length of a grid in Webflow and eliminate the grey space under the shorter ones, you can follow these steps:

  1. Create a grid: First, create a grid container by adding a div block and giving it a class name.
  2. Set the display property: With the grid container selected, go to the Styles panel and set the display property to "grid". This will enable the grid layout.
  3. Define the grid template: In the same panel, under the Layout section, you can define the grid template by setting the number of columns and their widths. For example, you can use "1fr 1fr 1fr" to create a 3-column grid where each column has an equal width.
  4. Add content to the grid: Insert div blocks or any other elements into the grid container. Each div block will be automatically placed in one of the grid cells.
  5. Adjust div block height: By default, div blocks will only take up the height of their content. To make them fit the full length of the grid, you can set the height property to "100%". This will make the div blocks expand to fill the available vertical space within the grid cell.
  6. Eliminate grey space: If there is grey space under shorter div blocks, it's likely because the other grid cells in the same row have more content. To eliminate this grey space, you can set the align-self property on the div blocks to "stretch". This will make all div blocks in the same row have the same height, regardless of their content.

By following these steps, you can make div blocks fit the full length of a grid in Webflow and eliminate the grey space under the shorter ones.

Additional Questions:

  1. How do I create a grid layout in Webflow?
  2. Can I change the number of columns in a grid layout in Webflow?
  3. What are some other ways to align content within a grid cell in Webflow?