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.


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

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

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

Go to End

10 Posts   18274 Views


20 June 2008 at 2:17am Community Member, 9 Posts


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?




20 June 2008 at 4:38am Community Member, 9 Posts

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.



20 June 2008 at 4:48am Community Member, 149 Posts

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.


20 June 2008 at 2:05pm (Last edited: 20 June 2008 2:06pm), Forum Moderator, 5511 Posts

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


21 June 2008 at 1:37am Community Member, 9 Posts

Hi wojtek, willr

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




19 August 2011 at 3:34pm Community Member, 130 Posts

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.

19 August 2011 at 4:06pm Community Member, 309 Posts

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.


20 August 2011 at 7:59pm Forum Moderator, 5511 Posts

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

Go to Top