Sunday 8 November 2020

Angular: Change Font Size options for users in IE11 (CSS-Variables)

I am developing an Angular application. From the webpage, the user can select a small, medium or large fonts (medium is the default) and based on that we have to change the font size all over the page. Now for other browsers, I can use var() but it is not compatible with IE. So one way of doing it is manually applying font-size in every single HTML tags either using ngStyle or ngClass. But I find this method really bad. Is there another way of doing it? I don't want to write this piece of code in every single component.

<div class="hm-header-title" [ngStyle]="fontSize()"></div>
fontSize(){
    return this.ieStyleService.fontSize() // ex return {'font-size': '11px'}
}


from Angular: Change Font Size options for users in IE11 (CSS-Variables)

No comments:

Post a Comment