The following VF page entitled TemplatePage looks fine when opened:

        .mainDiv { ... }

    <div class="mainDiv">...</div>

The following page does not look correct (styles are ignored):

    <apex:composition template="TemplatePage"/>

Why are template styles gone and how can I preserve the styles?

  • Can you please paste more about your page and css, please? I tried with your code and color: red in the css and it works for me in the main page
    – Lance Shi
    Commented Jul 28, 2015 at 1:31
  • This was due to different API versions for the 2 pages. Apparently they need to be on the same version. Your reply prompted me to create the entire thing from scratch only to see it work!
    – Mossi
    Commented Jul 28, 2015 at 1:46

1 Answer 1


Figured it out! The TemplatePage was on API 26.0 while the overriding page was on version 34.0. Setting both to the same version (either one) made it work!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .