• Resolved ahmedcheema

    (@ahmedcheema)


    I’d like to format my paragraphs on articles in a certain way by changing the margins and font sizes.

    I can do so like this:

    p{
    font-size: 20px;
    padding-right: 20%;
    padding-bottom: 10px;
    padding-left: 20%;
    }

    The problem is that this will also effect the excerpts you see below posts on the home page and category pages. I don’t want that to happen.

    One solution is to use classes like this:

    p.SomeClass{
    font-size: 20px;
    padding-right: 20%;
    padding-bottom: 10px;
    padding-left: 20%;
    }

    I could then apply the class manually to every paragraph in every post on the website. This is my last resort option because of how many pages I’d have to go back to, so I was wondering if there was another way to separately edit post and excerpt paragraph CSS

    • This topic was modified 3 years ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 2 replies - 1 through 2 (of 2 total)
  • I was wondering if there was another way to separately edit post and excerpt paragraph CSS

    That should be easy.

    If the site in question is the one in your profile, then the following selector should work, as the entry-content class should only be generated on individual blog posts/pages, and not on archive-type pages where excerpts are often shown.

    .entry-content p {
    
    /* Your custom style goes here */ 
    
    }

    And as a bonus, if you wanted to style the excerpts separately, you’d use something like:

    .entry-summary p {
    
    /* Your custom style goes here */
    
    }

    I hope that helps.

    Thread Starter ahmedcheema

    (@ahmedcheema)

    Super helpful, thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Edit paragraph CSS without altering post excerpts’ is closed to new replies.