0

So far I have custom CSS for all of my normal site pages that has been working properly and now I am trying to also use the CSS for other pages (Site Contents, any document libraries, lists, folders, etc). I am unsure how to get the CSS to apply to these pages as they seem to only use the default SharePoint CSS. Any tips on how to go about this?

For the other pages I just changed the order of which CSS files should be loaded when by adding CSSRegistration links in the Master page. Is there a way to add a Registration link that will only apply it to certain site content pages instead of all of them?

So after the last answer I know I can use JS for this and I am fairly certain I can write the code for that as well. The part I need help with the most is how to implement the JS. Site Contents has a folder for JS and I was wondering if I need to put it in there or if it would be directly on the Masterpage. any help or references you can point me to would be amazing.

1 Answer 1

1

As it sounds like you're aware you can apply a custom master page to either site pages or systems pages (related to your items above) or both.

So setting your custom css in the master page file you apply to the system pages with do this.

As for specific system pages you'll need to use javascript to detect the url pattern and inject the css script link only when the pattern is matched.

2
  • Thanks that's a big help, I thought there might be something javascript related for detecting it but wasn't sure. Do you have any help on how to go about the JS and or any reference you can link me to? I am fairly certain I could write the JS itself it seems simple enough, but I don't know how to implement JS in SharePoint. Would I be writing it in the Master page?
    – MikeDurso
    May 20, 2020 at 15:41
  • I would suggest adding a script link in the master page to a javascript.js file. Then this file cna be updated easily without publishing a new master page. then in this page implement a window.location.search function and you could do a If url contains "list.aspx" then insert this script
    – Warwick W
    Jun 21, 2020 at 23:56

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.