-
I’m using GeneratePress + GenerateBlocks and I’m stuck on what should be a simple 2-column layout that behaves properly on mobile.
What I’m trying to build
I want a reusable pattern / section where:
Desktop / Tablet:
-
Left: an image
Right: a black box with white text (e.g. “Related:” + some text)
The text on the right is vertically centred and left-aligned.
Mobile:
-
I still want image left, text right (no stacking).
The text has more width than the image (e.g. 30% image / 70% text or similar).
The text should be readable and not “scrunched up” into a narrow strip.
The text stays vertically middle, horizontally left.
This is the original problem that made me move away from the core Media & Text block. On mobile, Media & Text either stacks (which I don’t want) or, when “stack on mobile” is disabled, the text is squashed in a tiny column.
So I rebuilt it using GenerateBlocks, but I keep hitting new issues every time I fix one.
At one point this was a GB Grid block, but following advice I switched it to a Container with Display: Flex to get them side-by-side.
The GeneratePress Grid block was an absolute nightmare, It stacked and would never go side-by-side. I even spoke with C GPT for over an hour just simply trying to get the grid to have two blocks side-by-side, one on the left, one on the right. We both had to give up in the end LOL
So currently:
Outer Container:
Display: Flex
Flex Direction: Row
Flex Wrap: No wrap
Align Items: Center (for vertical centring)
Left Container: image
Right Container: text
Visually this now works on desktop: image left, text right, text middle/left.
On mobile, they do stay side-by-side, which is good, but the width and spacing behaviour is where it keeps going wrong.Problems I’m running into
When I use Flex Basis for widths on mobile (e.g. 30% / 70%)
If the right column is Display: Flex, I can get the widths closer to what I want, but I start fighting horizontal centring again and lose the consistent “middle + left” look.
If I change the right column to Display: Block to fix the alignment, Flex Basis stops behaving as expected (the 70% column doesn’t visually act like 70%).
When I try using Width instead of Flex Basis per breakpoint
I’ve tried setting widths (e.g. 50/50 on desktop & tablet, 30/70 on mobile) on the two inner Containers while leaving the parent as Flex row / no wrap.
Sometimes the widths are honoured, sometimes not. It’s very easy to end up with cramped text again or odd behaviour on one breakpoint.
Alignment tug-of-war
To get the text in the right column to sit vertically middle but left-aligned, I’ve had to juggle:
Parent flex alignment (Align Items, Justify Content)
Child container display (Flex vs Block)
Content / text alignment on the container
Text alignment on the Paragraph / Heading blocks
It’s very easy for one setting to undo another, especially when trying to give the text column more width on mobile.
In short: every time I solve one thing (stacking, centring, etc.), something else breaks: either the widths don’t behave, or the text re-centres, or it becomes cramped again.
What I’m asking for
Could someone please give me a clear, recommended block structure and exact settings for this layout, ideally as a pattern I can reuse?
Specifically:
Should the outer “row” be:
A GB Grid block using CSS Grid?
Or a Container set to Display: Flex?
What’s the official recommended way in GP/GB for a simple two-column hero/row like this?
For the outer row:
What should Display / Flex / Grid settings be on Desktop, Tablet, and Mobile to keep columns side-by-side and vertically centred?
For the two inner columns:
What should their Display be (Block vs Flex)?
Should I be controlling width with Width or Flex Basis, and what values would you recommend for:
Desktop (50/50)
Tablet (50/50)
Mobile (e.g. 30/70 or 35/65 so the text doesn’t feel squashed)
For the right text column:
How should I set vertical centring and left alignment so it’s:
Always vertically middle within the row
Always left-aligned inside the column
Which exact controls should I use (Align Items, Justify Content, Content Alignment, Text Align) so they don’t fight each other?
If you can describe the exact configuration (outer block type, display mode, flex/grid settings, widths per breakpoint, and alignment settings), or even share a minimal GB export for this pattern, that would be ideal. I’m happy to rebuild it from scratch the “GP approved” way, I just need a reliable, canonical setup that:
Keeps image left / text right on all breakpoints
Keeps text vertically centred and left-aligned
Avoids the cramped/“scrunched” feel on mobile by giving the text more width than the image
Thanks in advance.
-
Hi there,
I even spoke with C GPT for over an hour just simply trying to get the grid to have two blocks side-by-side, one on the left, one on the right. We both had to give up in the end LOL
It’s very easy. You just need to select the grid block, swith to mobile, and choose 2 columns layout in the settings panel > layout
https://app.screencast.com/6YkuAvJ4Lec0BTo adjust the portion of the left right, go to the styles panel > layout > grid layout. If you want it to be 30% 70%, set it to
3fr 7fr.
https://app.screencast.com/AvBbX3vxEcSF2Could someone please give me a clear, recommended block structure and exact settings for this layout, ideally as a pattern I can reuse?
You can use either one. I would go with Grid.
To vertically align to center, select each of the child containers of the grid, set
displaytoflex,align-itemstocenter. -
It’s very easy. You just need to select the grid block, swith to mobile, and choose 2 columns layout in the settings panel > layout
https://app.screencast.com/6YkuAvJ4Lec0BI literally did this, was the first thing I did then I asked GPT what am I doing wrong. I said this:
Under layout I have selected 2 columns, then in grid template columns it is set to this: repeat(2, minmax(0, 1fr)) When I change to 1fr 1fr nothing happens visually?
This is because it kept telling me to switch ti 1fr 1fr but either way, it didn’t make a difference, the blocks were still on top of each other and not side-by-side. In your image, I selected the two columns PMSL. Glad that I’m not going mad after all.
To vertically align to center, select each of the child containers of the grid, set display to flex, align-items to center.
Also, I did this.
-
When I change to 1fr 1fr nothing happens visually?
1fr 1frcreates the same layout asrepeat(2, minmax(0, 1fr)), so no change is expected. Try3fr 7frto see the results.You’ve set the grid-template-columns to
1fron mobile, so of course, it will only show 1 column.
https://app.screencast.com/HewdSmzclmrSM -
Hmmmmm… I think we are not on the same page.
The image you have provided, I mean I don’t understand it. What I am working on is a pattern in patterns.
It’s not about mobile, or anything else for now. What I basically want for now, is to completely recreate the Media & Text block so that I have full control over the mobile layout later, but I stumble at the first hurdle by not being able to put two simple blocks side by side LOL
I have told you what I have done, I don’t know how else to explain it?
Perhaps it’s a glitch or a bug, i don’t know….
-
The image you have provided, I mean I don’t understand it.
I just take it as an example. Can you point me to the section that is in question?
-
I mean, it’s a bit of a mess. Because the GeneratePress Grid block didn’t work, GPT recommended changing layout from grid to flex on outer container, and inner container of the text on the right to block, as it was centre but top centre and not start centre.
Here is an image of everything including View List = https://ibb.co/PGgxNygy
So it’s not the EASY way, but after hours of back and fourth for something that should be the easiest thing in the world, we got there LOL
Now, I want what I originally wanted, what (Media & Text Block) couldn’t give me. I want to edit mobile so they are side-by-side like you see in the image. Maybe the image on the left can be 30 and the text 70, but when I tried changing this, I ran into hurdles. It’s been a few days and I can’t remember what went wrong, but I don’t want them to stack, I want image and text side-by-side.
-
Because the GeneratePress Grid block didn’t work
It will work. And if I was you, I will use Grid block.
So it’s not the EASY way, but after hours of back and fourth for something that should be the easiest thing in the world, we got there LOL
It is easy 🙂
If you are using
display: flex, simply changeflex-directionfromrowtocolumnfor mobile. -
I’m gonna need to start a new topic because we keep going round in circles LOL
Doing this btw
If you are using display: flex, simply change flex-direction from row to column for mobile.
Changed it to stacking again, which is exactly what I don’t want.
I’m gonna have a mess around with it over the weekend, and if I have no success, then I’ll start a new topic and maybe simplify my wording or something. That first message I put had insane detail in.
Check back with you Monday, have a good weekend Ying 🙂
-
Thanks you too 🙂
-
For some reason, Once I started a new element, the grid actually worked. I was always using the GP grid, everything in GP is light blue and easy to spot. Seriously weird… But got it working fine 🙂 and setting it to 2 columns actually did it lol
Thanks for all the help in this thread Ying 🙂
-
Glad to hear that 🙂
- You must be logged in to reply to this topic.