Archived topic
Css class: Content area padding?
11 replies · Started by Sebastien on June 19, 2019
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
Hi there,
Any chance you can link us to the page in question?
I can provide the best suggestion that way.
Let me know :)
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.
Sorry I'm confused where you are seeing those settings.
Are you referring to these?
https://docs.generatepress.com/article/page-builder-container/
Yes that's it !
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;
}
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.
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 :)
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.
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>
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
So are you looking to have the background of the block extend full width and keep the content contained?