Apply CSS To All Posts
-
Hi I’m new to WordPress forums. And I am VERY new to CSS.
I’m working on https://harvestinus.co/category/all-messages/ and I want to make the margin between posts smaller and so I pasted this into the css:
#post-3874 {
margin-bottom: 40px;
}And that worked for post 3874, but I want that margin applied to all my posts. I’ve read to use .post and .post-id but neither have worked. Any help (in laymans terms) would be greatly appreciated.
The blog I need help with is: (visible only to logged in users)
-
Hi there,
There’s no page on your site at the link, https://harvestinus.co/category/all-messages/, as you don’t have any posts published in a category called All Messages.
But this code should work on category pages for your theme:
/* reduces space between posts on category pages */ .archive.category article { margin-bottom: 0 !important; } /* Reduces space between post title and byline on category pages */ .archive.category .entry-header { margin-bottom: 0px; }Remove all the code you currently have, and replace it with this – using a post id only targets a specific post, and will not change the display of all posts on a page. This code will work for all posts on all category archive pages.
The two posts that will still show a big gap even after you add that code, 6/6/18 – No Confidence In The Flesh and 5/30/18 – Soul Prosperity, is due to a non-breaking HTML space added at the end of each of those posts. To remove that, edit the posts and switch to the HTML view of the editor. Remove the & nbsp; appearing at the bottom of each of those posts and update, and they will be spaced the same as all the other posts.
- The topic ‘Apply CSS To All Posts’ is closed to new replies.