1

Through SharePoint 2013, there are some site pages that I would like to brand, while others can continue to use oslo default look and feel. What is the best way to add a style sheet to a selected site page? or change the default look and feel of a selected site page?

I do not want to edit the default admin master template...I simply want my site page to have it's own look and feel.

thanks

3
  • Have you tried adding the style sheet via script editor webpart?
    – Aveenav
    Feb 9, 2015 at 15:04
  • no i haven't, but I need the entire page styled...not just a specific area inside of the body element
    – klewis
    Feb 9, 2015 at 16:36
  • Having a content editor to load the css on load.?? Feb 10, 2015 at 10:14

2 Answers 2

1

You can link the external style sheet, which would be for the entire page. Add the Script Editor web part to the page and within the snippet add:

<link type="text/css" href="mystylesheet.css" />

To add the stylesheet to the head section, add the Script Editor web part and insert the following snippet:

var link = document.createElement('link');
link.href = '/_catalogs/Styles/mystylesheet.css';
link.rel = 'stylesheet';
document.getElementsByTagName('head')[0].appendChild(link);
9
  • but mystylesheet.css is being injected into the page...its not loading into the head of the page.
    – klewis
    Feb 9, 2015 at 18:48
  • this will not work, I only want to skin some of the site pages, not apply a snippet for all of them from the master page.
    – klewis
    Feb 9, 2015 at 19:39
  • Well, you'd only add snippet to the Script Editor web part for the SitePages you'd want to be branded.
    – Aveenav
    Feb 9, 2015 at 20:24
  • how do we edit an individual site page so that we can apply a snippet to it? what are the steps
    – klewis
    Feb 9, 2015 at 20:46
  • What are you referring to when you say Site Pages? did you mean Site Pages library that holds wiki page and web part pages or something else?
    – Aveenav
    Feb 9, 2015 at 20:57
1

I found this documentation on Microsoft's site to be more useful.

Place the custom CSS files in the Themable folder in the Style library (not the Themable folder in the Master Page Gallery). Only CSS files that are stored in the Themable folder in the Style library are recognized by the theming engine. The Themable folder is created automatically for publishing sites. Otherwise, you can create the Themable folder in the correct location (http:// SiteCollectionName/Style Library/language/Themable/).

You can name it custom.css and just reference it on the master page. Replace CSSFileLocation with the location of the CSS file. The following is an example of an <SharePoint:CssRegistration> element.

https://msdn.microsoft.com/en-us/library/office/dn266906.aspx

4
  • can you provide a particular passage from the link that you are referring you? msdn links are notorious for changing. Sep 11, 2015 at 17:50
  • Place the custom CSS files in the Themable folder in the Style library (not the Themable folder in the Master Page Gallery). Only CSS files that are stored in the Themable folder in the Style library are recognized by the theming engine. The Themable folder is created automatically for publishing sites. Otherwise, you can create the Themable folder in the correct location (http:// SiteCollectionName/Style Library/language/Themable/). Sep 22, 2015 at 19:54
  • You can name it custom.css and just reference it on the master page. Replace CSSFileLocation with the location of the CSS file. The following is an example of an <SharePoint:CssRegistration> element. Sep 22, 2015 at 19:54
  • @EricAlexander I hope that it answered your question. Aug 29, 2016 at 15:58

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.