Jump to:

23545 Posts in 19310 Topics by 2888 members

General Questions

SilverStripe Forums » General Questions » Adding CSS Class to CMS Root div

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

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

Page: 1
Go to End
Author Topic: 352 Views
  • bmh
    Community Member
    5 Posts

    Adding CSS Class to CMS Root div Link to this post

    I need to add a css class to the main #Root window of the CMS, which ideally could be custom controlled by the Page classes, but at the very least that reflects the PHP Class name that is being edited.

    For example.

    I have a custom php class called ArticlePage, it extends Page. I have added a custom field called YouTube Code, I want to be able to style the edit field for "YouTube Code" *just in on the ArticlePage edit pages*. So if I had a ReviewPage that also had a YouTube Code field, my css wouldn't affect it.

    So in other words, if I could find a way to add a class called "ArticlePage" to the div with id "Root_Main" then I could write CSS that would achieve this.

    Is this possible?

    I have found the CMSTreeClasses() method on SiteTree; this is similar to what I want to do, but different. This lets me style the individual items in the Site Tree hierarchy. I want to add a class to the edit fields container itself.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.