I am in the process of developing an Angular application. One of the requirements is to allow the user to choose between small, medium, or large font sizes (with medium being the default) and adjust the font size across the entire webpage accordingly. While the var()
function can be used for other browsers, it is not compatible with IE. Manually setting the font-size for each HTML tag using ngStyle
or ngClass
is one way to go about it, but I personally find this approach less than ideal. Is there a more efficient way to achieve this without having to duplicate this code in every single component?
<div class="hm-header-title" [ngStyle]="fontSize()"></div>
fontSize(){
return this.ieStyleService.fontSize() // for example, return {'font-size': '11px'}
}