Page 1 of 1

[Solved]How to add a bg img to a div, different on each page

Posted: Fri Feb 25, 2011 7:09 am
by jasnick
Just using HTML and CSS, I would give each page an id (body id="index">, body id="contactus">) and so on, so that I could change the CSS if necesary for individual pages.

I have a #sidebar that contains a #picturediv. I need to put a different image on each page as a background to the text in the #picturediv.

How is this sort of thing done in CMSMS?

Thanks.

Re: How to add a bg img to a div, different on each page

Posted: Fri Feb 25, 2011 8:18 am
by uniqu3
In your page template do something like:

Code: Select all

</__body class="{page_alias}>
In your stylesheet do then:

Code: Select all

body.home #picturediv {
 some: style;
}

body.contact-us #picturediv {
 some: otherstyle;
}

Re: How to add a bg img to a div, different on each page

Posted: Fri Feb 25, 2011 9:12 am
by jasnick
OK - thank you very much - I will do that!

Re: How to add a bg img to a div, different on each page

Posted: Fri Feb 25, 2011 3:49 pm
by uniqu3
just got reminded by Ronny on IRC that once again i wrote something stupid :)
So if you do use this dont forget $ before page_alias

Code: Select all

</__body class="{$page_alias}>

Re: How to add a bg img to a div, different on each page

Posted: Sat Feb 26, 2011 12:48 am
by jasnick
LOL - Thanks again! I'll mark this Solved now and post back if I have any difficulties.