Hello, I’m using the same CSS for each blog post, but I’m entering it in again and again each time we post something. I’d like the CSS to be added once and thenceforth referenced by each individual post without having it be there numerous times, which creates terrible code bloat. Please help?
Hi Jeremy,
Try using the selector .single-post prior to other selectors as it is the main selector for the single post pages.
So if you currently have the CSS:
.entry-title {
font-size: 20px
}
please update it to:
.single-post .entry-title {
font-size: 20px;
}
That way, all the elements with entry-title class of all post pages will have 20px font size.
Hope this helps.
Thanks for the quick response @Jade I’m trying that right now to no avail. Do you mean to do that for the CSS in the blog posts page listed in “pages?” Or for one of any of the blog posts in “posts?”
Hello @jeremy4,
Thanks for updating the thread. 
Above code will make the changes in single blog posts page. Please try entering under X > Theme Options > CSS and then let us know how it goes.
Thanks.
Thanks @Prasant, but I’m concerned I’m not explaining this correctly. I essentially want one set of CSS rules to apply only to all my blog posts but not to the rest of the website. Right now I’m copy/pasting the same CSS into each blog post, which is creating code bloat. If I were to enter this CSS into my global at X>Theme Options>CSS it would change everything on the website which would be too much. How do I simply target all blog posts at the same time?
Hi @jeremy4,
To target the index blog page, Use this code below to be added in your global custom CSS:
.blog .entry-title {
font-size: 20px
}
To target all single posts,
.single-post .entry-title {
font-size: 20px;
}
to target specific posts,
.postid-1135 .single-post .entry-title {
font-size: 20px;
}
Hope it helps.
Let us know how it goes.
Thanks.
We are delighted to assist you with this.
Cheers!
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.