Share via

Custom masterpage on sharepoint 2019 on classic site

Elias Balesamang 96 Reputation points
2021-08-31T10:21:24.82+00:00

I manage to create masterpage on sharepoint 2019 but i failing to att css on the master page, it does not render my css on the master page . My css on my html file look as follows:

<!--MS:<SharePoint:CssRegistration Name="Themable/corev15.css" runat="server">-->
<!--ME:</SharePoint:CssRegistration>-->
<!--SPM:<SharePoint:CssRegistration ID="CustomCSS" name="<% $SPUrl:~SiteCollection/_catalogs/masterpage/Bob/style.css%>" After="corev15.css" runat="server"/>-->
<!--SPM:<SharePoint:CssRegistration ID="CustomCSS1" name="<% $SPUrl:~SiteCollection/_catalogs/masterpage/Bob/grid.css%>" After="corev15.css" runat="server"/>-->

It always uses corev15.css, it does not load my custom css at all .

Thank you

Microsoft 365 and Office | SharePoint Server | For business
0 comments No comments

5 answers

Sort by: Most helpful
  1. sadomovalex 3,636 Reputation points
    2021-09-02T14:59:57.737+00:00

    check this post about similar issue with MIME type mismatch: SharePoint 2019 not loading style sheets in document libraries.

    Was this answer helpful?


  2. Elias Balesamang 96 Reputation points
    2021-09-01T09:35:22.383+00:00

    Something strange had happen on firefox it is rendering but with this
    The stylesheet http:// domain/_catalogs/masterpage/Bob/grid.css was not loaded because its MIME type, “application/octet-stream”, is not “text/css”.

    Was this answer helpful?

    0 comments No comments

  3. MichaelHan-MSFT 18,136 Reputation points
    2021-09-01T07:42:11.243+00:00

    Hi @Elias Balesamang ,

    By default, if you define styles in a custom .css file that are also defined in corev15.css, they are overwritten.

    You could try to use the !important rule in your custom css, check if works for you.


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    0 comments No comments

  4. Elias Balesamang 96 Reputation points
    2021-08-31T18:07:36.21+00:00

    @sadomovalex
    I did check the html output and it is like this see attached pdf127995-untitled-document.pdf

    It is published as major version and (approval is not in use)
    I need this since i need to do full customizing

    Was this answer helpful?

    0 comments No comments

  5. sadomovalex 3,636 Reputation points
    2021-08-31T14:27:18.317+00:00

    did you check html output: does it have <link rel="stylesheet"> tag which points to your file?
    Also can you access your css by direct url: http://MySiteCollection/_catalogs/masterpage/Bob/grid.css? Was it published with major version and approved (if approval workflow is in use).

    Also you may add custom css to OTB master page without creating custom master page. For doing that go to Site settings > Master page > Alternate css and set link to custom css file there. It will override OTB styles on pages.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.