简体   繁体   English

如何在 ng 样式中正确使用 css 的“calc()”

[英]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?我有以下使用 Angular 的 ng-style 和 css 的“calc()”的内联样式,但它没有用。谁能告诉我出了什么问题?

// my jade file has a class named '.logo-area'. 
.logo-area(ng-style="{'right':'calc(100% -'+({{fixedWidth}}+'px') +')'}")
.logo-area(ng-style="{'right': 'calc(50% - '+{{fixedWidth}}+'px'+')'}")

会解决问题。

这在 Angular 8 的 HTML 中对我有用

[ngStyle]="{'width': someAngularVariable +'px', 'left': 'calc(100% - ' +someAngularVariable + 'px)' }"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM