I have made a custom search portal for a sharepoint library. As instructed in a different topic here I have selected the stylesheet in the Settings of this site. But it seems this also applies to all top-level sites and document-library views. How do I apply a stylesheet to a single site?

  • 1
    I assume you are using the alternateCssUrl property and classic sites. Just reference the css in the page using a content editor or script editor web part. – Bunzab Apr 11 '17 at 13:14

Put a Content Editor WebPart on te page with a LINK to a CSS file.

If it's not a WebPart page you have to go the more technical route:

Use JavaScript, which adds a LINK element to document.head in the MasterPage itself; but you need to check the URL for execution on the correct page

More technical is a Web Scoped UserCustomAction, a JavaScript file which only executes on the Web (and not its SubWebs)
Easy to attach using the SPEditor Chrome Extension:

  • Thanks a lot for suggesting that extension, will definitely check that out. – Thomas A. Apr 11 '17 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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