change default margins and padding

My web pages have too much white space and I find myself changing the margin and padding px values on every page.

How can I change the default values for margins and for padding, for all rows and modules? specifically: top/bottom/left/right?
Thanks,
Tom

Hey Tom,

Defaults can be changed under Tools > Global Settings. :slight_smile:

Ben

Thanks Ben,
I would like to change the settings for top and bottom to “0” and leave right and left “20” - like i can do in individual modules. That doesn’t seem doable in the global settings - I only see a single setting for both margins and padding.

Am I missing something?
Thanks,
Tom

Hey Tom,

We don’t have a setting to set the margins individually but we have a filter that should be able to achieve that. Can you try adding the code below and see if it works for you?

function my_builder_register_settings_form( $form, $id ) {
    if ( 'module_advanced' == $id ) {
        $form['sections']['margins']['fields']['margin_left']['default'] = 20;
        $form['sections']['margins']['fields']['margin_right']['default'] = 20;
    }
    return $form; // Must be returned!
}
add_filter( 'fl_builder_register_settings_form', 'my_builder_register_settings_form' , 10, 2);

Ben

Hi Ben,
I installed the code above in Tools/Global Settings/Javascript, and did not get the results I am seeking. The results were:
Row settings were:
Margins: 0/0/0/0
Padding: 20/20/20/20
Text Editor module settings:
Margins: 20/20/20/20

What I’m seeking is all the above settings: 0/0/20/20

Please take a look at build.concordwebbuilders.com/test-margins

Ah, sorry about that! You need to place the code inside the functions.php file of your theme, preferably a child theme.

Give that a shot and let us know how it goes.

Ben

He Ben,
It did not go well at all:
I placed the code you gave me on April 14 (above) into functions.php of the ResponsivePro-child theme, and the website became inaccessable with the error below
The build.concordwebbuilders.com page isn’t working
build.concordwebbuilders.com is currently unable to handle this request.
500

When I removed the code from functions.php by using FileZilla, the site functioned normally.

I tried removing only the “add_filter” statement, and the above breakage still occurred. Only by removing both the “function” statement and the “add_filter” command did the site become operational again.

What can I try next?
Tom

Can you share both admin and FTP access to the site so we can check? Also, the code above will not work on existing modules, just on the new modules that you place on the page.

Ben