[Resolved] Add Padding to Elements using the before_main_content hook

Home Forums Support [Resolved] Add Padding to Elements using the before_main_content hook

Home Forums Support Add Padding to Elements using the before_main_content hook

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #851496
    Scott M

    i was asked to start a new support thread on this topic.

    i used elements to add a paragraph before the posts start on a dedicated blog page. the hook i’m using is before_main_content. The location of the paragraph is exactly where i want it, but there is no padding around that paragraph like there would be if i had created the page using the page builder. i have considered re-creating the page with the page builder and standard sections, but i’m not as happy with the formatting of the blog section.

    anyway, the padding issue looks ok on the desktop (not ideal though), but the text on this intro paragraph runs up against the edge of a mobile display. id really just like that paragraph to have the same padding as a regular page section. you can see what i’m talking about on the news page of my site, which was submitted with this request.

    i’m a novice with css, and tried using simple css to add code recommended in different threads, but with no success. i appreciate the help!

    #851690
    Leo
    Staff
    Customer Support

    Hi there,

    Try wrapping the content in the hook with a <div> like this:

    <div class="my-content">
        Your existing content
    </div>

    Then add this CSS:

    .my-content {
        padding: 10px 20px 0px 20px;
    }

    Adding CSS: https://docs.generatepress.com/article/adding-css/

    Let me know if this helps 🙂

    #851697
    Scott M

    magical. it’s resolved. thanks!

    #851809
    Leo
    Staff
    Customer Support

    No problem 🙂

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