Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Conditional width or center alignment for Grid Block

  • Hi guys,

    I have a pretty old headache with customizing the width or center alignment for Grid Block depending on the number of post previews to display inside it.

    For example, I have a full-width container block with a 4-column grid-block inside. And works fine until it’s 4 posts to display. But if it’s only one, it fills only 25% of the screen width on the left. Everything on the right is blank. Is there some solution to control grid block width based on the number of existing items to display, to make sure that it’s always center-aligned?

    An example of a page with only one item to display in the 4-column grid is in the private section.

  • Hi there,

    You can select the grid block and set its horizontal alignment to center, so it will be in the center.

    But there isn’t a built-in way to make the column wider based on post numbers, unfortunately. It will require custom JavaScript.

  • Actually, it solves my problem 🙂

    So thanks a lot for a fast solution, Ying!

  • You are welcome   🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.