Image background for Posts

Hello,
I’ve read on another post to put this code to add a background image for post page

body.blog .backstretch{
display: none !important;
}
body.blog {
background: url(image.jpg);
background-size: cover;
}

It’s works nice but the background is not here anymore when i click on a post.
How can i have the same background for each post ?

Hi Lyser,

The code above will add the background image to the blog page only. If you want a background image added to the posts, please update this code:

body.blog {
    background: url(image.jpg);
    background-size: cover;
}

to

body.blog,
body.single-post {
    background: url(image.jpg);
    background-size: cover;
}

That is because it is only the main blog page that has the .blog class that is why you have to add the .single-post class in the code to also target the posts.

Kindly note that since this is a custom code that changes the default behavior/display of the theme, you will be responsible to maintain or update the code in case you require further changes or if the code stops working in future updates.

Hope this helps.

Perfect, thank you =)

You’re most welcome. :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.