Question

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

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top