Hi @Mohammed Abed ,
In SharePoint 2019, the recommended way to apply custom CSS to a Publishing Site and ensure it overrides the default styles is by creating a custom theme. Here's the approach you can follow:
Create a custom theme:
Go to the root site of your SharePoint Publishing Site.
Open Site Settings.
Under the "Look and Feel" section, click on "Change the look."
Customize the theme using the provided options or upload a custom theme file ( and ) that includes your custom CSS and font definitions..spcolor.spfont
Upload the custom CSS file:
In the same "Change the look" settings page, click on "Theme" from the left navigation pane.
Upload your custom CSS file (e.g., ) that includes the CSS rules and font-face declarations.custom.css
Apply the custom theme to the Master Page:
Open the Master Page in SharePoint Designer or any preferred text editor.
Locate the section of the Master Page.<head>
Add the reference to the custom CSS file within the section, like this:Make sure to adjust the URL path based on the location where you uploaded the custom CSS file.
<link rel="stylesheet" href="/sites/YourSite/_catalogs/theme/15/YourThemeFolder/custom.css" />
Save and publish the Master Page.
By following this approach, SharePoint will apply the custom theme, which includes your custom CSS file, to the entire site and override the default styles. The custom font-face declarations should also be recognized and applied correctly.
Remember to clear the browser cache to ensure the latest CSS changes are loaded when testing.
Note: It's always recommended to make a backup of the original Master Page before making any modifications.
I hope this helps you achieve the desired customization in SharePoint 2019!
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.
Best Regards
Cheng Feng