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

Archive /

Our old forums are still available as a read-only archive.

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

layout.css and typography.css always showing in source in new theme

Go to End

10 Posts   27814 Views


Community Member, 9 Posts

20 June 2008 at 2:17am


I am building a new theme, so I created a new folder under 'themes'.
Then I changed the _config.php file to point to the new theme. That all worked perfect.
They I was having a 'light blue' background but I never set that background.
I looked at the source code of the resulting HTML page and I found that there are 2 lines that are included there but I didn't write them:

<link rel="stylesheet" type="text/css" href="cms/css/layout.css" >
<link rel="stylesheet" type="text/css" href="cms/css/typography.css" >

These lines magically appear in the source and they mess up my design.
Why are they included and how can I remove them?




Community Member, 9 Posts

20 June 2008 at 4:38am

ok, found the problem, but I still don't understand why is developed that way.

When I create a new theme the files layout.css and typography.css are kind of mandatory.
If they are there, it takes the new files automatically.
If they are not there, it takes the one from Silverstripe admin page.

For me that doesn't make sense since the idea was to create a totally new theme.



Community Member, 149 Posts

20 June 2008 at 4:48am

ok, let me explain it:

first, the files layout.css, typography.css and form.css are mandatory to standardize the creation of themes.
What's more, the CMS uses the typography.css file to display the content correctly during the edition.
If these files are not detected, the default ones are used - in fact, it's not about the css files but about the whole themes.

It shouldn't be a problem to name your files layout.css and typography.css to make things easier, but if it is, just create empty files with such names and then no default styling will be used.


Forum Moderator, 5523 Posts

20 June 2008 at 2:05pm

Edited: 20/06/2008 2:06pm

Nothings fixed in the 'core' apart from editor.css - if you want to control the fonts / colors in the cms then you have to use a editor.css.

In the current theme editor.css just @imports the typography css so we can have styles for the CMS only in editor.css. Styles for the CMS and front end in typography.css and styles for the front end in layout.css.

But you have full control over how ever you want to do it in your theme!. You can even choose not to include the CSS as we have - Via a PHP method (Requirements::css()) - you could hard code them in the theme if you wanted to or call them style.css and mysite.css or whatever - just remember to edit the Requirements call in the page.php file


Community Member, 9 Posts

21 June 2008 at 1:37am

Hi wojtek, willr

Thanks for the information. That will help me a lot.




Community Member, 138 Posts

19 August 2011 at 3:34pm

I'm mobilising a website so wanting to call typography.css and layout.css in a non-standard way. What code do I need to use to make sure they aren't automatically inserted into the page?

I've tried the following code in /mysite/code/Page.php

// Disable automatic inclusion of layout.css and typography.css

Any help would be appreciated.

Ryan M.

Community Member, 309 Posts

19 August 2011 at 4:06pm

Why not just comment out or delete the requirements call in Page.php to ensure they aren't included? If you started your site theme by copying the blackcandy one and changing it to fit your design, the Page.php file will have the typography and layout requirement calls inside it already.


Forum Moderator, 5523 Posts

20 August 2011 at 7:59pm

@tama - instead of clear() you would want to use block() in that case.

Go to Top