The CreatorCon Call for Content is officially open! Get started here.

CSS Font size best practice: PX vs REM?

Prakhar7
ServiceNow Employee
ServiceNow Employee

There has been a long standing discussion in our team, whether should we use px or rem for CSS in Service portal widgets.

I understand that we can define the base font size for a Portal in the service portal record. But what happens when the widget is used in many different portals? 

If we want our widgets to appear and behave the same way in multiple portals, which one should we use REM or PX?

1 REPLY 1

Satoshi Abe
Mega Sage

Hi @Prakhar7 

Very interesting discussion.
In my opinion, REM is the way to go. For example, one of the advantages is that when you change the default font size for each template in multiple portals, it is automatically reflected on the widget side as well. On the other hand, it would require more time and effort to design the widget to accommodate the change in size, but I think REM is slightly preferable when accessibility is also considered.