Howto remove space between wordpress divi theme's sections - css

How I can remove space between wordpress Divi theme's sections?

Vasili has a great answer, however, when you view the properties of a row/column in the Divi builder - you will see two rows of settings for Custom Margin and Custom Padding. These will be under the regular options on some elements, and under Advanced Design Settings on others.
By default those are left blank, however that does NOT mean that they are set to 0. If you change the padding on top/bottom and margin on top/bottom to 0 you should be able to remove the space without having to use code, and a ton of CSS !important tags.
As a general rule of thumb, avoid !important tags as much as possible. Overwriting certain rows in DIVI is not always going to be effective - you may have a row where you need padding on one page, and twenty that you don't on others. I would suggest trying to do as much as possible through the builder, if that is what you are using to build the page.

To make this more useful for beginners.
Without using code you can try if just putting another row within the same section is enough for you.
If not we could do what poostchi has done we can change the css for the section.
Now if you go to your website and right click a section and select inspect element (assuming your browser is chrome) you will see your section coded like this.
<div class="et_pb_section et_section_regular" style="background-color:#2388e0;">
<div class="et_pb_row">
<div class="et_pb_column et_pb_column_4_4">
<div class="et_pb_text et_pb_bg_layout_dark et_pb_text_align_left">
This is row 1 section 1
</div> <!-- .et_pb_text --><div class="et_pb_text et_pb_bg_layout_light et_pb_text_align_left">
this is row 2 of section 1
</div> <!-- .et_pb_text -->
</div> <!-- .et_pb_column -->
</div> <!-- .et_pb_row -->
</div>
Here we see they are using the class et_pb_section
clicking on the class name will show the class css code which has the 50 pixels padding value:
.et_pb_section {
padding: 50px 0;
position: relative;
}
So all we have to do is overwrite the padding value there to 0 which was what pootschi has done.
.et_pb_section{
padding-top: 0px !important;
}
the !important tells css to overwrite with this.
But by doing this ALL your sections DIVI defined padding value will be overwritten.
So what if you only want to reduce a gap for only a specific section?
Divi has included the css ID an css CLASS to allow better customization over their sections an modules. You can find this by clicking on the edit button of our section.
CLASS method
Give your section a CSS CLASS name: reduce_top_padding_here
then you can do this.
.reduce_top_padding_here {
padding-top: 0px !important
}
Now where do we put this css code?
Divi has allowed easy css edit by going into
Appearance > Divi Theme Options > General Settings >
scroll down to find "Custom css" (paste the code in here.)
Explanation:
Here you have created your own css class. So ONLY the section or module that you give this class name to, will inherit this css display instruction to give the top padding 0 pixels. Instead of over writing DIVI's main .et_pb_section class.
Note the dot in front of the class name means in css that name is a class.
So summary to edit a specific section
1- Give your section a CSS CLASS
2- then define that CSS class value in divi theme options > "custom css"

I'm not sure if Divi theme had this at the time but if you go to the Divi Theme Customizer > General Settings > Layout Settings there's Section Height and Row Height.
For mobile go to the Divi Theme Customizer > Mobile Styles, Phone and Tablet both have section and row heights.
You still may need some CSS.

I just found it!
.et_pb_section{
padding-top: 0px !important;
}

I would like to expand on what Vasili has shared, in order to provide a more complete answer (especially regarding the exclusion of full width sections).
I suspect Alex Seidler's answer has missed the point. I suspect the questioner wants to remove this padding site wide. Doing that via the Divi builder, as he suggested, is going to be very tedious and will in fact introduce a lot more (Divi generated) additional CSS to the site, including all the !important tags (regarding that, see the last note at the end of this answer).
Just as Vasili and the person who asked the question has pointed out, the following code will override the padding on all sections.
.et_pb_section{
padding-top: 50px !important;
}
Note, that 54px top and bottom is currently the default on screens over 1350px. 4% is the default on screens 981p and less. I say "currently" because I recall it used to be 50px. It might still be 50%. Whatever the case, reduce this according to your needs. The questioner wants all spacing removed, in which case set it to padding-top: 0 !important.
Excluding full-width sections
The above-mentioned change may have some undesirable effects if you use any full width sections. If that occurs, you may want to exclude those sections, with the following:
:not(.et_pb_fullwidth_section).et_pb_section {
padding-top: 50px !important;
padding-bottom: 50px !important;
}
Remember, this will impact all rows, within all sections.
Specific Sections only
If you want to only override the padding on specific sections, use the suggestion made by Vasili in his answer.
Reducing Row padding
Anyone wanting to reduce the default section vertical padding might also find themselves wanting to reduce Row vertical padding.
For that, add this CSS to your child-theme styles.css file:
.et_pb_row { padding-top: 30px !important; }
30px is the default. Reduce this to suit your needs.
Specific Rows only
To reduce specific rows only, you can either do it on a row-by-row basis in the Divi Builder "Design" tab for the row(s) in question, or you can give the rows a unique class (in the "Advanced" tab of the row settings), and then apply the settings to that class in your your child-theme styles.css file. This is the same process as changing specific sections. For example, give the rows the class `row-reduced-top-padding' and then it the styles.css file:
.row-reduced-top-padding { padding-top: 10px !important; }
The advantage of this method is it is much faster to adjust the settings later on, especially if you've applied this to quite a few rows.
Avoiding !important, not possible
As for the comment from Alex Seidler about avoiding using the !important tag: Whilst it's true it's best to avoid this, in this situation it's unavoidable. Last time I checked, even Divi itself will use the !important tag when you make changes to the margins and padding of sections and rows via the Divi Builder. This is because it is also having to over-ride the site-wide defaults, which have already been declared by Divi.

Related

How to get another woocommerce css theme to put in my main theme?

Sorry for being a newbie but i really need your help.
Heres the problem: i have my main wordpress theme with woocommerce, everything works fine. The thing is: i have a secondary theme with another woocommerce style and i need to get this woocommerce css to my main theme.
How could i do this? Because even if i copy paste the .css file, i will still need the html class's from the other theme.
I dont know what to do anymore, i really apprecite any help.
Thanks and sorry, english is not my native language.
#edit
i forgot to say: i dont need all the woocommerce css, i just this the product view. Like this: https://image.ibb.co/kkPtEc/Sem_t_tulo.png
You can use:
https://es.wordpress.org/plugins/custom-css-js/
Use appropiate selectors to target the elements that you want and reach them with more precision to take priority over other css.
For example:
.elementor-745 .elementor-element.elementor-element-lueowvi .elementor-image-box-content .elementor-image-box-title {
color: #0351d8;
font-size: 27px;
font-weight: 500;
}
this is a css selector with it's properties and values (copied from a wordpress that i did some time ago)
if i want this text for being red instead of this kinda blue and change the font size, for example, i'll have to:
div.elementor-image-box-wrapper > div.elementor-image-box-content > h3.elementor-image-box-title {
color: red;
font-size: 30px;
}
Why i did this selector?
i know that this element is inside a div with elementor-image-box-content class, which is inside a div with elementor-image-box-wrapper.
Note that i also specified the html tag in css selector.
Why should it work?
the selector i set is more specific compared to the main theme one. So it will take priority when the css is rendered.
If you deal with id-based classes you'll need javascript (i recommend you to use jQuery as it's loaded by the theme or by some plugin almost always and will let you work faster an cleaner.
when i say id-based classes i mean those like:
<div class="product-id-25">
<!-- other code -->
</div>
<div class="product-id-26">
<!-- other code -->
</div>
You'll need to select product-id-* and make a for each loop to add the css through jQuery (for example)

Increase width on Mailchimp signup box using Wordpress divi theme

I'm working on a client's website using the Wordpress Divi theme https://www.nationwidescents.com/ I didn't use it but I've ran into a few troubles customizing things that disagree with this theme (has anyone else had that issue?)
So in the footer on the bottom right, I'm trying to add the mailchimp signup box. It's there now but I want the width to be wider (100%). I've tried in-line css on the embed code and also trying these class tags with the width CSS in the additional CSS:
.input#mce-EMAIL.email
#mce-EMAIL.email
.email
#mce-EMAIL
.mc_embed_signup_scroll
Still haven't cracked it. any suggestions?
Could you please try:
#mc_embed_signup input#mce-EMAIL {
width: 100%;
}
The thing with your selector is that they all match, BUT there is already a selector with a "width: 50%" attribute: #mc_embed_signup input.email
This selector overrides your selectors and therefore the 50% remained. You could use this calculator to check or read up on CSS specificity.
Hope this helps!

CSS - adjust container width

I'm making a few changes to a site and want to change the width of the container to go across the whole page. I'm a bit of a noob so not sure if I've don't it correctly, but want the width to be 3000px. I have the option of container id and container class. So basically what CSS do I put in which box?
The theme I am using is Porto by Spyropress. But looking for some CSS help:)
Thank you very much!!
In the CSS style page (or code) where you have the container, you should write the following line:
width:3000px;
The most straightforward answer would be to use the style="width: 3000px;" definition instead of the id or the class (even if it is not a really clean choice).
If you have no chance to add a style and you have called a CSS, you can do it by id or by class, depends on how often you will have Elements with 3000px width (single time go for id, multiple times go for class). In general classes and id link the parts in your CSS with your html definitions (named-links). They do not serve you with direct CSS, this is done by the style="" Element.
Some Code:
#some_id {
width: 3000px;
}
.some_class {
width: 3000px;
}
And some additional info about general css (because it is much more than just id's and classes if I think about the cascading part): http://www.cssbasics.com/

Wordpress styling extra margin

I'm working on a Wordpress site and I'm quite new to this framework. There's some CSS on my page that's causing each "row of content" to have a 35px margin between it. This appears to be in a css class called wpb_row in a js_composer.css file. I'm not sure if this is some standard CSS class for Wordpress or if there's a global "have margin between each layer of content" setting.
Unfortunately I don't have 10 rep so I can't post an image of the page that's causing the issue but I can link to an image of where the issue is http://i.imgur.com/vEyznRn.png?1 and the url for the site is http://am12.siteground.biz/~youbambu/ecorecycling/
What's the best way to override a CSS class within Wordpress from a standard point of view? I've tried adding custom css to override this and remove the margin-bottom: 35px; in Appearence->Editor->Stylesheet.
Is it possible to either override this CSS in one global area? I'm using a theme called Picasso in wordpress if that's any help, but I don't see how to override this CSS.
To overrride the css use !important. So adding the following to your stylesheet should remove the margin bottom:
.vc_row.wpb_row.vc_row-fluid {
margin-bottom: 0 !important;
}
Is it possible to either override this CSS in one global area? I'm using a theme called >>Picasso in wordpress if that's any help, but I don't see how to override this CSS.
I would be careful editing/modifying there because I suspect you will lose these changes/modifications on theme updates (which Picasso auto updates).
The theme has a designated place located at Theme Options > Tools > Custom CSS. The adjustments you add here are loaded on every page, just like the stylesheet in editor. Furthermore, these changes are not cleared upon update.
Just my two cents, hope it helps.
You can easily achieve this goal. This is not a WordPress standard or something.
you can edit js_composer.css and change what you want. OR
you can override this css rule adding a new role after js_composer.css loads. Something like:
<style>
.wpb_row { margin-bottom: 0px!important }
</style>

Avoid overriding by css

I have created a UI (for wordpress plugin) in which I give user choice to add text, image, and video in a div ( lets call this div, container).
I have been working on it for a quite sometime. I recently added tinyMCE (WYSIWYG editor) to add text inside container.
Now, I realized that I did a big mistake. The text user writes is being overridden by css rules defined for wp admin panel.
for example,
User enters <h1>Hello</h1> (with the help of tinyMCE), and then I grab that content from tinyMCE and append that in the container.
But here the problem arises, wordpress's admin css can have css rule like this,
h1 {
color : #d6d6d6;
line-height: 40px;
font-size: 30px;
}
So, it looks different in tinyMCE and in my container. (as tinyMCE's code is inside iframe and that remains unaffected by wordpress's css rules, but my container doesnt)
I want something so that any element inside container remains unaffected by wordpress's admin css.
I know a good solution would be putting container inside iframe. But I have written a lot of code without thinking of an iframe and I would need 3-4 days just to adjust everything for iframe. There may be some cross browser issues.
I can reset some wordpress rules, but it will fail sometimes, as user may enter anything. I need something fullproof.
well if you want to undo a specific rule (say the h1 rule you mentioned) you can use css to override it by being more specific.
.container h1 {
color:#000000;
line-height: 24px;
font-size: 24px;
}
This will overwrite the css rule you mentioned with the given values but only when the element is inside the container class, (I'm guessing at the default values you want to use.)
Unfortunately you would have to add in an undo rule for everything that wordpress's admin css changes.
Another possible solution is to edit the page tinyMCE returns in it's frame to add in wordpress's CSS file. This means the end user will see the same formatting when they enter the information as when it gets posted.
Do you have code-level access to the iframe contents tinyMCE creates?
Use !important in your CSS document. This way your CSS will not be overridden as it takes precence over everything, including inline styles.
h1 {
color:#ff0 !important;
}

Resources