0

I have created a custom masterpage HTML page as well as several custom stylesheets for a site in SharePoint online. I have attempted to reference my stylesheets in the HTML page but my styles are not being picked up in the browser. I have tried to reference the css using the following formats within the head tag, none have worked.

<!--SPM:<SharePoint:CssRegistration ID="Custom" Name="$SPUrl:~SiteCollection/SiteAssets/search/css/custom.css%" runat="server" After="Themable/corev15.css"/>-->

<!--SPM:<SharePoint:CssRegistration ID="Custom" Name="https://dynamiconline.sharepoint.com/sites/search/SiteAssets/MarvinSearch/css/custom.css" runat="server" After="Themable/corev15.css"/>-->

<link href="https://dynamiconline.sharepoint.com/sites/search/SiteAssets/MarvinSearch/css/custom.css" rel="stylesheet" type="text/css">

Hoping someone can point me in the right direction on how I need to format these correctly so my styles will actually come through. Any assistance is appreciated.

2
  • Try the last option ( <link ...> ) again but add the closing slash to the end. ie <link href="/sites/search/SiteAssets/MarvinSearch/css/custom.css" rel="stylesheet" type="text/css" />. The masterfile may be looking for a closing tag that isn't there.
    – KGlasier
    Apr 30, 2019 at 17:41
  • @KGlasier I appreciate the suggestion, unfortunately I tried this and my stylesheets are still not coming though.
    – bberndt
    Apr 30, 2019 at 18:05

1 Answer 1

1

You can use the code below.

<!--SPM:<SharePoint:CssRegistration name="&lt;% $SPUrl:~sitecollection/SiteAssets/search/css/custom.css %&gt;" runat="server" after="SharepointCssFile" />-->

Check the thread below:

External CSS file in HTML master page

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.