[Resolved] Setting Custom Category Page Padding on Mobile

Home Forums Support [Resolved] Setting Custom Category Page Padding on Mobile

Home Forums Support Setting Custom Category Page Padding on Mobile

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1379182
    Andres

    Hello,

    How can I set the left and right padding on specific custom php category pages for mobile?

    There are about 8 custom php category pages on our site. We wanted to adjust the left and right padding on all but three of them to prevent the content from going from edge to edge on mobile (on desktop, it’s fine).

    I’ve included the URL for one of the category page in question.

    Is this possible? How can it be done?

    Thank you very much!

    #1379236
    David
    Staff
    Customer Support

    Hi there,

    WordPress adds unique body classes to posts, pages and archives.
    If you right click inspect your category archive in the body tag you will something like:

    category-your-slug

    In the case of your wedding resources category it is:

    category-wedding-resources

    And you can use it in your CSS like so:

    .category-wedding-resources #content {
        padding: 40px;
    }
    #1379398
    Andres

    Hello David,

    Thank you very much. That did the trick!

    One question. If I wanted to apply the same CSS to multiple categories, is it necessary to one of those for each category, or is it possible to include all the wanted categories in the same instance of CSS, in something like the CSS below?

    .category-weddings .category-engagements .category-venues  #content {
        padding: 40px;
    }

    Again, many thanks, David.

    Cheers!

    Andrés

    #1379405
    David
    Staff
    Customer Support

    You have to add each CSS selector in full, separated by a comma , – Like so:

    .category-wedding-resources #content,
    .category-engagements #content,
    .category-venues #content {
        padding: 40px;
    }
    #1379408
    Andres

    Hi David,

    Thank you!

    Andrés

    #1379501
    David
    Staff
    Customer Support

    You’re welcome

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