• Resolved rabrol

    (@rabrol)


    Hello again.

    I created some pages today and wanted to change the font size of the body text on some pages, not on all. However, adding a font-size to the main CSS file also increases the font size of the menu.

    I would like the menu size to remain the same, but to be able to increase font size or even change font type on certain pages and posts.

    What is the best way to accomplish this? More custom CSS?

    Thanks for the help!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Theme Author athemes

    (@athemes)

    To target specific pages or posts you can use code like this:

    .page-id-xx .class {
       attribute: value;
    }

    Replace ‘page’ with ‘post’ to target a specific post.

    You could also try this plugin: https://wordpress.org/plugins/custom-css-for-pages-and-posts/ (I haven’t tested it but should work).

    Thread Starter rabrol

    (@rabrol)

    Thanks for the suggestion. I went with the second option, but it seems the body tag also includes the menu.

    When I increase font size using

    body {
      font-size: 28px;
    }

    the menu and titles all get bigger too. Of course this only affects the individual page, not all the pages of the site.

    However I am attempting to increase the font size of just the main text on a page/post, not have the menu fonts change as well.

    Any other ideas?

    Theme Author athemes

    (@athemes)

    Can you please share a link to the page so I can see for myself?

    Thread Starter rabrol

    (@rabrol)

    Hi – sorry for the delay.
    The page is at http://artofthriving.ca
    The About Us page has the custom page CSS setting font size to 27px (for example purposes). You can see the Menu items also increase to this size 🙁

    Hi, I will try.

    First, body tag contains all page elements (your entire page).

    For your particular case, try this:

    article#post-80 {
      font-size: 20px;
    }

    And ofcourse remove previously added changes for body.

    If you want to customise other pages, open specific page in google chrome and hit 12. Select desired element on your page with magnifying glass and you will see it’s ID or CSS class.

    Thread Starter rabrol

    (@rabrol)

    Great, thank you. This worked.
    I wonder if there is a way to do it without needing to refer to the actual post ID.

    Would
    ‘article {‘
    work on its own?

    Well, yes. But it will lower font size on all pages, which you can later increase for desired pages by using ID. 🙂

    Thread Starter rabrol

    (@rabrol)

    OK, thanks for the help.
    In the end I just added

    article {
      font-size: medium;
    }

    in Custom CSS which I already had installed. I removed the second custom CSS plugin for pages & posts.

    As you mentioned, I lose the ability to modify the pages individually for now, but I didn’t need that functionality anyway. I had only wanted to change the size in all the posts.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Font Sizing’ is closed to new replies.