3

我使用 Angular 的 ng 样式和 css 的“calc()”进行了以下内联样式,但它不起作用。谁能告诉我有什么问题?

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

2 回答 2

3

This worked for me in HTML with Angular 8

[ngStyle]="{'width': someAngularVariable +'px', 'left': 'calc(100% - ' +someAngularVariable + 'px)' }"
于 2020-04-29T09:25:57.827 回答
2
.logo-area(ng-style="{'right': 'calc(50% - '+{{fixedWidth}}+'px'+')'}")

将解决问题。

于 2015-10-14T21:07:49.403 回答