Adding custom CSS/JS/Image in Sharepoint 2010

Adding CSS

 1. Add "Layouts" mapped folder to sharepoint Project.

2. Create a folder structure layouts/1033/styles/themable 

3. Add the css file to the styles folder .If you are using themable styles then also add it to themable folder too

4. Register the CSS file by adding following line into your Master Page

 <SharePoint:CssRegistration name="custom.css" runat="server" EnableCssTheming="true" after="true">

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.cssregistration.aspx

(Note: Another approach From sharepoint designer add css file to style library and refer it in css registration)

Adding JS

1. Add "Layouts" mapped folder to sharepoint Project.

2. Add you JS file to layout/1033 folder or your project specific folder

3. Add the script link to your Master Page

<SharePoint:ScriptLink name="custom.js" runat="server" OnDemand="False" Localizable="False" />

Adding Images

1. Add "Image" mapped folder to Sharepoint Project.

2. Add the images to the folder or your project sub folder under images  

3. Refer the image like  /_layouts/images/MyProject/testimage.png

Folder 1033 (Locale ID for English -United States ) is language specific folder in which language/Locale specific resources are stored.You could get complete list LCID http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx.

By default it will look at Layouts/1033/styles folder for locale  (English -United States) . If theme is applied then it will look Layouts/1033/styles/Themable folder.

Ebook Download
View all
Learn
View all