Archived topic
Style H2 Inside Posts To Be Different To Standard H2 Styling
3 replies · Started by Jenny on April 6, 2023
Hi, I would like to style my H2s inside any posts to look different to H2 anywhere else on my site.
I've added some custom css to restyle the H2 and that works well, but I only want it to look like that in my posts.
You can see via the link to a post on my website below, that the H2 have a light grey background which is exactly how I would like them to appear in my posts, but I don't want that for my regular pages.
Website Post Example
This is the code I have in my additional CSS
* h2 {background-color: #ebedf0; text-align: centre; padding: 15px 10px 15px 10px;}
Is it possible to make this code ONLY for any H2s inside my post content?
Thanks so much for any help. Much appreciated.
Hi there,
Edit your CSS to this instead:
.single .content-area .post h2 {
background-color: #ebedf0;
text-align: center;
padding: 15px 10px 15px 10px;
}
Let me know if this helps :)
That works perfectly thank you Leo.
No problem :)