3

anyone idea how to add custom CSS file to SharePoint 2016.

2013 way "<SharePoint:CssRegistration ID="CssRegistration2" Name="/Style Library/css/customized.css" runat="server" After="corev15.css" />" not working.

Thanks a lot

4

Regardless what's the way that you are using, but the following steps should be working in SharePoint 2016

  • Upload your custom CSS file to Style Library or Site Assets
  • Go to site setting > Look and Feel > Design Manager > Publish and Apply Design > Assign Master Page based on device channel .

enter image description here

  • At Alternate CSS URL > Specify a CSS file to be used by this site and all sites that inherit from it: > Browse your file.

  • Check Reset all subsites to inherit this alternate CSS URL if you need to apply this for all Subsite.

enter image description here

[Update]

After I updated your question, you were missing the format of code. so I found out you are using SharePoint:CssRegistration , So try to use it as the following

<SharePoint:CssRegistration name="&lt;% $SPUrl:~sitecollection/_catalogs/masterpage/css/customized.css %&gt;" runat="server"  />

Or

<SharePoint:CssRegistration ID="CssRegistration1" name="&lt;% $SPUrl:~sitecollection/_catalogs/masterpage/css/customized.css %&gt;" runat="server" after="SharepointCssFile" />

For more details check Starter Master Pages for SharePoint 2016

  • Still not working :( I dont have enabled Publishing infrastructure feature. – Dominik Divák Sep 18 '16 at 8:27
  • My fault: Now working perfect. <SharePoint:CssRegistration ID="CssRegistration1" name="/SiteAssets/custom.css" runat="server" after="corev15.css" /> – Dominik Divák Sep 18 '16 at 8:40

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.