Could I set diff background imgs on diff pages w/jquery

This is what I am looking at…
I have several pages, each one should have a diff background image in the ccs body tag. e.g.

body{
background:url('imgs/image.png');
}

is there a way to load them with jquery or even css or do I need to make a diff stylesheet per page (wich is what is looking like to me so far).
Thank you.

You can assign a different class or ID in the body tag for each page, then associate the respective background image with that class/ID.
Assuming all of the pages call the same css file, that should work just fine.


#page1 {background:url(...);}
#page2 {background:url(...);}
#page3 {background:url(...);}

and the HTML would be

<body id="page1">

etc.

Hope this is helpful.

Ronpat, what a good point.
I had actually not even thought of assigning an id to the body (kinda like the html) usually w/the exception of adding a background to it I leave them alone.
No reason why it shouldn’t work will try it out.
Thank you!
D

Ronpat, a quick follow up.
That was a dead on great suggestions. Worked great.
Thx

You’re very welcome, Sherpa. Glad to contribute to the cause :slight_smile: