Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do properly use css's "calc()' with ng-style

I have the following inline-styling using Angular's ng-style and css's "calc()', but it didn't work. Can anyone tell me what's wrong?

// my jade file has a class named '.logo-area'. 
.logo-area(ng-style="{'right':'calc(100% -'+({{fixedWidth}}+'px') +')'}")
like image 412
zihaow Avatar asked Dec 07 '25 01:12

zihaow


1 Answers

This worked for me in HTML with Angular 8

[ngStyle]="{'width': someAngularVariable +'px', 'left': 'calc(100% - ' +someAngularVariable + 'px)' }"
like image 177
Krishna Sagar Avatar answered Dec 08 '25 14:12

Krishna Sagar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!