1

I'm very new to sharepoint and I saw many customization on sharepoint sites using CSS codes.

Where do I need to put those codes? Like, what page do I need to edit on my master pages? Is it the Seattle, V4, Oslo? I don't have any idea, even on their differences, and do I need to place every images to Style Library before applying it to CSS?

Give me brief on where to apply CSS and masterpage?

2 Answers 2

4

Ideally, you would start by creating a copy, rather than editing one of the existing master pages.

Which one you choose is purely up to your own aesthetics. Once you're familiar with their creation, you can create one from scratch and with the built in design tools (available through the front end, generates web parts and unique content).

As to where to put CSS:

1) If you have CSS that is just used on one page, just put it on that page. Calling unneeded CSS creates extra load (data and processing alike).

2) If you have code that is just used on one or more page layouts, you could include it in the page layout, but that makes it harder to compartmentalize changes. Better to add a reference to a purpose built CSS (CustomWiki.html including a reference to CustomWiki.css).

3) CSS shouldn't be included in the master page, even if it's not something that's going to change often. Create a CSS file for each master page and reference it below your corev15.css. Ex:

        <!--SPM:<SharePoint:CssRegistration Name="Themable/corev15.css" runat="server"/>-->
        <!--SPM:<SharePoint:CssRegistration Name="/_catalogs/masterpage/_css/CustomSiteMaster.css" After="corev15.css" runat="server"/>-->

Ideally you would place all of your assets in a library before using them, but you can create the code ahead of time if you know where it will live and what it will be called, but an image file referenced in the CSS that is missing won't break anything, it just won't load the images.

2
  • Hi, Thank you for that response. Question about your answer no.1, that I will put the CSS on that page? what do you mean by that? where do I need to put the code? Sorry, I'm really new to this. and by No.3, did you mean that I need to create a CSS file for example in Style Library then call that CSS file using code that I need to put on master pages?
    – spideynok
    Apr 11, 2015 at 1:22
  • 1
    Scripts (CSS, JavaScript, JQuery, etc) go into a script editor web part on the page. You can technically put content in a script editor, but it's best to keep them separate in your page design if you have to find it later. For 3) Correct. Create a CSS file, put it in style library (or wherever you'd like that you can control). I updated my answer for #3 w/ an example reference.
    – Graham
    Apr 11, 2015 at 11:02
1

You can directly embed the css on your page as mentioned in this blog : http://techwirenews.com/2013/04/15/embed-your-css-in-sharepoint-2013-web-pages/

Other way is edit the master page and embed your css their.

A guide to quick SharePoint 2013 branding

Refer Scripts and CSS Style Sheet in SharePoint 2013 Visual Web Part and Master Page

Your Answer

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

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