OPEN TO WORK

Available for new opportunities! Let's build something amazing together.

Fixing font styling issues in your SPFx application customizers

Application Customizer SPFx SharePoint Framework Styling
post

This post is over a year old, some of this information may be out of date.

This will be a quick tip about a styling issue with the application customizers. If you are building application customizers that render something in the available top or bottom zones. It is recommended to add your own font styles. This might sound weird, but when you don’t do this, you might end up with styling differences between your pages.

Here is an example of loading a sample application customizer on a modern page and in a list view:

Show image Font size differences between pages
Font size differences between pages

The text on the list view is a bit bigger. The reason for this font size difference is that the body element on a modern page contains the ms-font-m class. This automatically sets the font size to 14px and font weight to 400.

Show image ms-font-m class on body
ms-font-m class on body

On all other pages, this class is not present and due to that differences will occur.

Show image No ms-font-m class present
No ms-font-m class present

An easy fix would be to add the ms-font-m class on the root element from your application customizer.

Related articles

Report issues or make changes on GitHub

Found a typo or issue in this article? Visit the GitHub repository to make changes or submit a bug report.

Comments

Elio Struyf

Solutions Architect & Developer Expert

Loading...

Let's build together

Manage content in VS Code

Present from VS Code