1) In My custom master page I have registered my CSS as follows,

<SharePoint:CssRegistration name="/mycssfolder/css/mycss.css"  After="corev4.css" runat="server"/>

Now I have my folder mycssfolder, with me. Where should I place it? I placed in the root directory under my port 2222.

2) In my CSS I have a reference to an Image that reside in mycssfolder, now is my reference correct? Where should I place this folder? [Actual folder mycssfolder/images/mainBG.jpg]


3) Now finally If I am deciding to place my Entire folder mycssfolder in a document library called 'css'. Then how should I change these entries?


3 Answers 3


1) You can place your styles sheets in the Style Library. With SharePoint Designer way to get there is to navigate to "All Files -> Style Library". There you can create your mycssfolder to keep your custom CSS's separate. You can also navigate to Style Library using a browser from Site Actions, or directly with URL http://YOURURL/_catalogs/masterpage/Forms/AllItems.aspx.

Then in your master page you would reference to the CSS like /Style Library/mycssfolder/css/mycss.css.

2) That reference looks correct. In my example you should place it in /Style Library/mycssfolder/images/mainBG.jpg

Difference with this and having files under _layouts is that Slide Library is normal SharePoint list, so it will have versioning, permissions, etc. _layouts is probably slightly quicker to work with as you can use any editor you wish and saving modifications to a server hard drive is quicker than saving a file with SPD to SharePoint database.

Then again, you need to separately have backups of the stuff you put in _layouts, where as if the files would be in Style Library, they would be backed the same time you back up SharePoint database or farm.

So both have pros and cons.

  • As I understand the Styles Library locates in the RootWeb of a site collection, in theory the user can have access to the subweb and don't have rights to the root web. How this issue can be resolved?
    – Alexander
    Jan 31, 2012 at 7:07
  • Such scenario is possible. You need to grant read permission to all users into the Style Library list. Also these style libraries are site collection specific, so you need to consider caferully which option to choose if you have multiple site collections.
    – Jussi Palo
    Jan 31, 2012 at 7:15
  • 1
    There is also stackexchange question from related about where to place css files - sharepoint.stackexchange.com/questions/2219/… Jan 31, 2012 at 7:27
  • Thanks a lot jussi for your detailed help, and currently what I did was I created a document library called mycssfolder and put all other folders and files inside that. This is working, correct, whether any draw back for this method? anyways +1
    – Jithu
    Jan 31, 2012 at 7:39

If your css folder structure is like following:


You can reference image in your MyCssFile.css like this:


This is the best becuase you can move your MyCssFolder any where and you don't need to change the path of image in css because it is relative to that css file.


There is a STYLES folder in Layouts folder. You can place CSS there. Then you can use name="/_Layouts/STYLES/mycssfolder/css/mycss.css". But it is not a rule. You can place your css in any place under Layouts folder.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.