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

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Locked
sage12
New Member
New Member
Posts: 7
Joined: Wed Aug 08, 2018 9:19 am

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

Post by sage12 »

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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

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

Post by velden »

One rather common way to do this is to use:

Code: Select all

</__body id="{$page_alias}">
Obviously {$page_alias} will be replaced with the alias of the specific page.

Other possibility would be the use of the 'Extra Page Attribute x' attributes (Options tab when editing a page) and https://docs.cmsmadesimple.org/tags/cms ... /page_attr
User avatar
Rolf
Dev Team Member
Dev Team Member
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

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

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Locked

Return to “Layout and Design (CSS & HTML)”