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

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,273 questions
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. sadomovalex 3,631 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.

    0 comments No comments

  2. 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

    0 comments No comments

  3. MichaelHan-MSFT 18,021 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.

    0 comments No comments

  4. 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”.

    0 comments No comments

  5. sadomovalex 3,631 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.