[Resolved] Css class: Content area padding?

Home Forums Support [Resolved] Css class: Content area padding?

Home Forums Support Css class: Content area padding?

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #935013
    Sebastien

    Hi,

    Is there a Css class that I can use to be able to use (retrieve) the layout padding even when my content is under a div position:absolute or when my page is set : Content> Content Area > Full Width (no padding)
    thanks

    #935022
    Leo
    Staff
    Customer Support

    Hi there,

    Any chance you can link us to the page in question?

    I can provide the best suggestion that way.

    Let me know ๐Ÿ™‚

    #935031
    Sebastien

    There is no page in question.
    At the moment I use: Content> Content Area > Content (no padding)
    I would like to be able to change into : Content> Content Area > Full Width (no padding) but keeping the same padding that the previous situation.
    I wished GP would provide a CSS class that store these params.

    #935038
    Leo
    Staff
    Customer Support

    Sorry I’m confused where you are seeing those settings.

    Are you referring to these?
    https://docs.generatepress.com/article/page-builder-container/

    #935053
    Sebastien

    Yes that’s it !

    #935063
    Leo
    Staff
    Customer Support

    So just to make sure, you want to add padding when full width option is selected?

    If so try this CSS:

    .full-width-content.separate-containers .inside-article, .full-width-content.one-container .site-content {
        padding: 20px;
    }
    #935074
    Sebastien

    No,
    I want to add the same padding with full width (no padding)‘s option selected than with content (no padding)‘s option selected.
    I don’t want to set manually the px of the padding. I wished I could use a CSS class using the padding param of the content layout already stored in GP.

    #935189
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    So you want to apply the padding values from the Customizer to the Full Width template?

    If so, try this:

    add_action( 'wp_enqueue_scripts', function() {
        if ( function_exists( 'generate_spacing_get_defaults' ) ) {
            $spacing_settings = wp_parse_args(
                get_option( 'generate_spacing_settings', array() ),
                generate_spacing_get_defaults()
            );
    
            $padding = generate_padding_css( $spacing_settings['content_top'], $spacing_settings['content_right'], $spacing_settings['content_bottom'], $spacing_settings['content_left'] );
    
            wp_add_inline_style( 'generate-style', '.full-width-content.separate-containers .inside-article, .full-width-content.one-container .site-content {padding:' . $padding . '}' );
        }
    } );

    Let me know ๐Ÿ™‚

    #935413
    Sebastien

    Hi Tom,

    that doesn’t work: the full width is still full width.
    Maybe I miss explain my case: I’m not sure it is padding value… I’m trying to apply the margin that uses by grid-container.

    #935546
    David
    Staff
    Customer Support

    Hi there,

    not sure i fully understand what you’re trying to do but for example if you have a Full Width page container and you wanted a DIV to keep the container width set in Customizer then you would add the grid-container class to it e.g

    <div class="grid-container">
    <!-- my contained content markup goes here -->
    </div>
    #937617
    Sebastien

    Hi mates,

    Thanks David for explanations.

    My issue still persistes because I try to add grid-container CSS class to a “Group” wp block.
    But it s already automaticly own another Class > grid-container called alignfull which forces full width..
    Any other idea ?

    My aim is to be able to decide which block I need to be full width and which block I need to be with a “standard” layout width.

    thanks

    #937733
    David
    Staff
    Customer Support

    So are you looking to have the background of the block extend full width and keep the content contained?

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