Hello, I have a question about making columns nested inside a row and column layout the same height as the other nested columns within each separate column. I am wondering what the best way is to do this. I have a screenshot below so what I’m talking about is more clear. I have 5 columns, and each column has two rows, with one column in each row (I’m not sure if it would be better if there was just one row with two columns, perhaps?). Anyway, I want the heading and text columns to all be the same height, regardless of the amount of text in each column. Is using the min height attribute the best way to achieve this? I was wondering if there was something more streamlined, since if I use that I’ll have to adjust it for every breakpoint.
Thank you!
Hey @m_kraft,
Thank you for reaching out. I understand you would like the heading and text boxes in your five nested columns to share the same height at every screen size, without setting a min-height at each breakpoint. Please review the steps below to resolve this.
The reason min-height feels necessary is the structure: each of your five Columns is a separate container, and the browser can only give boxes equal heights when they share the same row. The heading in Column 1 and the heading in Column 3 never share a row, so nothing can line them up automatically. Using one Row with two Columns has the same limitation. The Grid element solves this, because every cell in a grid row is automatically as tall as the tallest cell in that row.
-
Build the section as a Grid – Add a Grid element with 10 Cells, in reading order: Heading 1, Text 1, Heading 2, Text 2, and so on. Place your heading and text elements inside the matching Cells. In the Grid’s Layout group, set the Columns template to five equal columns (1fr ×5) and the Rows template to two rows (auto ×2).
-
Position the Cells on desktop – On each Heading Cell, set its X Axis (column) Start to its position (1 to 5) and its Y Axis (row) Start to 1. On each Text Cell, set the same X Axis Start and a Y Axis Start of 2. All five headings now share row 1 and all five texts share row 2, so each set matches the tallest item automatically. No min-height is needed, and it adjusts as the text changes.
-
Stack them on smaller screens – Switch to the breakpoint where you want the layout to stack, set the Grid’s Columns template to a single column (1fr), and clear the Start values on the Cells at that breakpoint. The Cells then follow their reading order: Heading 1, Text 1, Heading 2, Text 2. The vertical alignment of the Cell contents can be set per Cell or with the Grid’s Items Y control.
Check out these recommended resources:
-
Grid – Official Documentation — see the Columns Template and Cell Placement Controls sections -
Themeco YouTube — search “Grid”
We would love to check your columns if you can share your WP Access in the secure note in your next reply.
Best Regards.
