Applying css stylesheet to a specific site/page in Sharepoint Online
-
17-12-2020 - |
Вопрос
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?
Решение
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: