Archived topic
Different background image on each page
4 replies · Started by Tully on January 12, 2017
Hi Tom, I'd like to have a different background image on each page, and be able to adjust the position, fixed or scroll, size etc?
Hi Tully,
Each page has a unique class in the <body> tag.
You would first need to find the page/post ID - it's actually hidden in your URL when you are logged in. Look for post= and that number is your page ID.
Then your CSS would be something like:
.page-id-1234 {
background-image: url('URL TO THE IMAGE');
background-position: center;
background-attachment: fixed; /*default is scroll*/
background-size: 80px 60px;
background-repeat: no-repeat;
}
Adding CSS: https://docs.generatepress.com/article/adding-css/
Let me know if this makes sense.
You can also use a plugin to display your page ID.
https://wordpress.org/plugins/reveal-ids-for-wp-admin-25/
Thanks Leo, perfect!
You're welcome :)