Adjusting the font and size throughout the web application

Each PrimeFaces theme has a specific font family and font size, which can be different from theme to theme. This may have a disadvantage in a multi-theme application because switching from one theme to another would cause a broken layout. Furthermore, default font sizes of themes might be bigger than expected. Hence, it is important to know how to change font properties of the PrimeFaces components globally.

In this recipe, we will learn how to adjust the font family and font size throughout the web application.

How to do it...

A simple way to change fonts globally can be accomplished by using the .ui-widget style class. An example of smaller font is as follows:

.ui-widget, .ui-widget .ui-widget ...

Get PrimeFaces Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.