Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » CSS QUESTION

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: 649 Views
  • servalman
    Avatar
    Community Member
    211 Posts

    CSS QUESTION Link to this post

    Hello

    My client wants his site to be for some page with an overall black backround and white types and other pages the opposite so my question is

    how do you insert custom css files to override the layout and typography ?

    I have read some solutions but it is still not clear, does someone have something that would work with 2.4 properly

    Thanks

  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: CSS QUESTION Link to this post

    You can use section command in layout template.

    <% if Section(Alfa) %>
    <div id="a">..............</div>
    <% else %>
    <div id="b">..............</div>
    <% end_if %>

  • prawnstar
    Avatar
    Community Member
    116 Posts

    Re: CSS QUESTION Link to this post

    I think the easiest way would be to create a second template and put something like this in the head of your new template file:

    <% require css(themes/your-theme/css/your-style.css) %>

    servalman's method would work too, but if you have a lot of template code between those div's, you may just want to create an additional template.

    Chris.b

  • TotalNet
    Avatar
    Community Member
    181 Posts

    Re: CSS QUESTION Link to this post

    The 'best' solution will depend largely on how your client will decide which pages are white-on-black and which are black-on-white.

    Will it be alternating sub-pages in a parent page; parent pages in one, sub-pages the other; simply by ticking a box in the CMS for that page; or are they different page types (Page sub-classes)?

    Personally, I would avoid creating additional templates and css files and go for setting the class of the main element (body or containing div) using a variable in the template Page.ss e.g.

    <div class = "typography {$BlackOrWhite}">


    Then you decide the value of $BlackOrWhite in your Page class depending on the conditions above and style for class black/white accordingly in your layout.css

    Rich

    649 Views
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.