Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

How to add css class to body tag dynamically?


Go to End


3 Posts   1517 Views

Avatar
VPull

Community Member, 58 Posts

6 May 2015 at 11:50pm

I have created new field called BaseColor in page Main Content. I want set value of that field as a class name for body tag.
e.g.

<body class="BaseColorFieldValue">

Avatar
Willr

Forum Moderator, 5523 Posts

7 May 2015 at 9:29pm

> I have created new field called BaseColor in page Main Content.

<body class="$BaseColor"> should do it?

Avatar
VPull

Community Member, 58 Posts

7 May 2015 at 10:10pm

Thanks for reply Willr. It works.