Adjusting the font and size throughout the web application
Each PrimeFaces theme has a specific font family and font size, which can differ 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 { font-size: 90% !important; }
Note
Using !important
in CSS can sometimes be useful to force a rule, so that you can place your CSS in any order in HTML.
This might not be enough in some cases, especially when you mix PrimeFaces and JSF standard...