-
Hi
I have a wine page where I display wines with query loop.
I have tried to change the number of grid items with Global Styles and custom media query – but without success.For example, I have tried, on the Post Template container, to create a Global Style with media query @media (max-width:767px) and (min-width:400px and set width to 50% for displaying 2 grid items.
But it doesn’t work…
-
Hi there,
Can you show me the entire CSS generated by the global style?
And can you link me to the page in question?
-
Global Style CSS:
@media (max-width:767px) and (min-width:400px) {
.av-wine__grid {
width: 50%
}
} -
Grid block has another container that’s invisible in the editor, so you are actually adding the class
av-wine__grid
to each column’s inner container instead of the column itself, that’s why it won’t work.You will need this CSS:
@media (max-width:767px) and (min-width:400px) { .gb-grid-column.gb-query-loop-item:has(.av-wine__grid) { width: 50%; } }
In GB 2.0 (still in the alpha stage), the Grid block will be simplified, and it uses CSS grid instead of flexbox, you will be able to use global style to control the grid items.
If the site is still under development, I would suggest give the GB 2.0 alpha a try.
-
Thank you for pointing that out.
It makes sense.I’ve put in the CSS code, and now it works 🙂
Regarding GB 2.0.
I have a test site, where I have GB 2.0 installed, and have tried to look in it, but I cant see how to do it. -
Hi there,
in the block settings you can add extra media queries in the blocks setting – see here:
https://app.screencast.com/DFTXZWX8jesST
Just add NEW, and add you query ie.
@media (max-width:767px) and (min-width:400px)
Then you can apply styles to that block ( or global style ) for that specific media query size -
I’m aware of adding additional queries.
But I can’t figure out what setting I need for displaying post template grid in 2 columns with @media (max-width:767px) and (min-width:400px).
I have tried setting width size to 50%, but it doesn’t work. -
Here’s the basic knowledge of Grid CSS:
https://css-tricks.com/snippets/css/complete-guide-grid/And here’s a video:https://youtu.be/sNfussCGsNI?si=pw6IdC6RcmvF8j8d
Once you read the article above and watched the video, you should have a rough idea about Grid CSS.
To set the Grid items to be two columns, you just need to select the Grid block, go to the Grid layout panel, and select the two-column layout. It will automatically fill the field with
repeat(2, min-max (0, 1fr))
.Here’s a screenshot for your reference:
https://app.screencast.com/FEHLyyCrNsUAX -
Thank you, also for your patience 🙂
I’ll look into it…
-
No Problem 🙂
- You must be logged in to reply to this topic.