How to reduce space before and after title / header text

hi,

can anyone assist as to how to reduce space as highlighted in attached screenshot?

looked for it in customiser / theme options, but couldnt seem to find it?

thanks,

daryn

Hey Daryn,

There is a default top margin for the heading elements. To get rid of that, please add the class mtn to the h2 element on that page like this:

Please check this link for more CSS Ready Classes available that you can use:

Hope this helps.

thanks Jade,

i will try it now.

regards,

darryn

Thanks Jade,

I tried it and placed it on page : https://www.myopinions.co.za/terms-of-use/

Terms of Use

There is no change in the space above or after : terms of use:

Perhaps i wasnt too clear in my question earlier or i have done something wrong?

please advise?

Sorry Jade, i forgot to mention i placed it in the following place, which might be incorrect?

Hey Daryn,

No, please do not put the HTML code in the body class field. You will have to edit the actual page content of those pages and add the class to the heading element such as the h1, h2, up to h6.

You can switch the editor into html mode so you can see all the html code of the page content.

Hope this helps.

Thanks Jade,

I will try it now. Much appreciated.

Regards,

Darryn

You’re always welcome!

Let us know if you need further assistance. Thank you.

Hi Lely,

Sorry i am extremely intellectually challenged. I am trying to find where i can switch the editor to html mode as the classic editor doesn’t show the html code of the page?

Please would you steer me in the right direction please?

Darryn

Hey Lely,

I tried this in classic editor: text and have screenshot the attached and placed code Jade said i should use?

Not sure if i am doing the correct thing?

Darryn

Hi Darryn,

Yes, that is right. The HTML mode of the default Wordpress editor is the Text tab.

You just have to add the class suggested to the heading tags such as h1, h2. h3, to h6 to get rid of the default top margin.

Hope this helps.

Hi Jade,

I did that and no difference as per my screenshot?

Hi Darryn,

I am not sure what you mean because the default space above the heading was remove after you have added the class.

Here is now it looks without the class:

And here is now it looks now:

As you can see, the gap above the heading has lessened.

If you want to further decrease the gap between the header to the top area of the container, you will have to add more custom CSS since there is a default 60px padding between the default content area of the page. To do that, please add this code in X > Theme Options > CSS:

.page-template-default .x-container .x-main .entry-wrap {
    padding: 30px 60px;
}

Feel free to play around the padding value in the code above.

Hope this helps.

Thanks Jade, you are a superstar!!! Thats exactly what i was looking for…

Darryn

You’re most welcome, Darryn. :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.