[Support request] Background color in headings (H2, H3)

Home Forums Support [Support request] Background color in headings (H2, H3)

Home Forums Support Background color in headings (H2, H3)

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #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!

    #826647
    David
    Staff
    Customer Support

    Hi 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.

    #826650
    Casper 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.

    #826664
    David
    Staff
    Customer Support

    So 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.

    #826695
    Casper Madsen

    Thank you so much! That worked.

    #826702
    David
    Staff
    Customer Support
    #1883076
    Simon

    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!

    #1883088
    Elvin
    Staff
    Customer Support

    Hi 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?"

    #1883377
    Simon

    Hi Elvin
    Thanks for that! I have just applied it and all is well! πŸ™‚
    Best wishes
    Simon

    #1884329
    Elvin
    Staff
    Customer Support

    No problem. Glad it works for you. πŸ˜€

    A wise man once said:
    "Have you cleared your cache?"

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.