Depending on which page you are on, the body will have different classes, assuming your Wordpress Theme calls the function body_class.
The homepage has the class "home", so you can use that to target the div, since my understanding of your question means that you don't have other ways to differentiate this div from others.
Thank you for your suggestion!
And I assume I have to write a php funtction like "if body has homepage class apply that css property"
Can you help me with this ?
I'm using a wordpress theme and I want to apply a background image to a div just on homepage.
How can I do this ?
Depending on which page you are on, the body will have different classes, assuming your Wordpress Theme calls the function body_class.
The homepage has the class "home", so you can use that to target the div, since my understanding of your question means that you don't have other ways to differentiate this div from others.
Thank you for your suggestion! And I assume I have to write a php funtction like "if body has homepage class apply that css property" Can you help me with this ?
as an example
What Wolfcry wrote.
The style should go in the CSS, not in the PHP.