- This topic has 9 replies, 2 voices, and was last updated 1 year, 7 months ago by
Elvin.
-
AuthorPosts
-
March 2, 2019 at 8:35 am #826616
Casper Madsen
Hi. Is it possible to add background color to headings in posts and on pages, in the same way you can with paragraphs?
Thank you!
March 2, 2019 at 9:13 am #826647David
StaffCustomer SupportHi there,
i assume you are using the block editor. Unfortunately not using the Core blocks from within the editor. You would need to give the block an Additional CSS class and some CSS. Let me know if you need help with that.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 2, 2019 at 9:15 am #826650Casper Madsen
Yes, I’m using the block editor. I know nothing about CSS so some help would be great. I have the Simple CSS plugin installed if that helps.
March 2, 2019 at 9:28 am #826664David
StaffCustomer SupportSo select the Heading Block > Settings (Sidebar) –> Advanced Tab.
In the Additional CSS field add a CSS Class. You can name this whatever you like, make it descriptive if you can eg.header-bg-blue
Then in the Customizer > Simple CSS you can write a CSS Rule for that Class eg.
.header-bg-blue { background-color: #2020ff; /* Change hex color */ padding: 20px; /* Add some padding to the heading */ }
You can create different classes with separate rules for different colors or padding variations.
Then its a case of just assigning the Class to any heading block you need it on…. or any block actually.The nice part is you can then change all of them across your site just by editing the CSS.
Note:
/* this is a comment */
– it isn’t required just a handy way of keeping notes of what it does.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 2, 2019 at 10:16 am #826695Casper Madsen
Thank you so much! That worked.
March 2, 2019 at 10:22 am #826702David
StaffCustomer SupportGlad to be of help.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/August 4, 2021 at 12:45 am #1883076Simon
Hi,
Is this still valid today? I guess there have been some changes to GP since this was posted.
I was hoping to achieve something like this for H2 and H3:https://drive.google.com/file/d/1GWntIA9YiSTdc-6NxkrlLiFKcF6-Hf55/view?usp=sharing
Cheers!
August 4, 2021 at 1:01 am #1883088Elvin
StaffCustomer SupportHi Simon,
Yes, this is still valid. π
The same thing can be done to any text blocks. This is assuming there’s no conflict in CSS coming from other custom styling. (if any)
A wise man once said:
"Have you cleared your cache?"August 4, 2021 at 6:08 am #1883377Simon
Hi Elvin
Thanks for that! I have just applied it and all is well! π
Best wishes
SimonAugust 4, 2021 at 7:40 pm #1884329Elvin
StaffCustomer SupportNo problem. Glad it works for you. π
A wise man once said:
"Have you cleared your cache?" -
AuthorPosts
- You must be logged in to reply to this topic.