Site logo

[Resolved] Assign class name to all new blocks

Home Forums Support [Resolved] Assign class name to all new blocks

Home Forums Support Assign class name to all new blocks

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2545702
    David

    Hi, is there a way to (a) add a custom CSS class name to all new container blocks without having to enter the name manually in the customizer, and (b) allow styling changes in the customizer to override any styles assigned to that class name in the stylesheet? Thanks…

    #2545825
    David
    Staff
    Customer Support

    Hi there,

    if you use GenerateBlocks Pro then you can save the Container with the class in a Local Pattern.
    Then you can add the pattern for each container.
    But then you may also want to use a Global Style to sets on that Container , which would allow you to update the styles.

    Otherwise, no you can’t add a class automatically .
    But you could just target the default .gb-container class.

    What styles are you wanting to manage from the customizer ?

    #2545852
    David

    Thanks David. Up to now, I have set all container padding and background colour values via custom CSS classes linked to my child theme stylesheet and added additional classes for e.g. different padding values pd-80, pt-80, etc, just to avoid too much CSS being generated on the fly by GP and keep more control within a single stylesheet. However, some customers want to periodically ‘re-design’ their pages with different paddding, margins and background colours. I’m basially trying to minimise the manual addition of extra CSS classes but still give customers flexibility via the best available method. Thanks…

    #2546327
    David
    Staff
    Customer Support

    To do it with GB you would need to save them as Local Patterns ( with just the classes or with global styles ). Then get the user to build from the patterns, they don’t have to worry about classes and if need be the styles can be updated in the future.

    #2546849
    David

    Thanks David…

    #2547246
    David
    Staff
    Customer Support

    You’re welcome

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