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.

Accordion with alternating background colors

  • Hello,
    I want to create accordions with synchronized styles and alternating background colors:
    1 st item: color 1 rgba(255, 194, 51, 0.05)
    2 nd item: color 2 rgba(77, 255, 0, 0.05)
    3 rd item: color 1
    4 th item: color 2 and so on.
    How can I do this?

  • Hi there,

    You can set different background colours for each accordion item.

  • OK, but then I can’t synchronize the styles. Is it possible to do it with some CSS?

  • Yes, it’s possible, you can create custom selectors for the accordion block.

    For example, if you want to target the odd accordion items, then create a selector >.gb-accordion__item:nth-child(odd).

    Here’s a screenshot for your reference:
    https://app.screencast.com/3yaJtvjNZrKxF

    In the example, I’ve created a custom selector for odd accordion items, and changed the background color to purple.

  • Ah, ok, I used still the GB1 version.
    Thank you 🙂

  • No Problem 🙂

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