如何使用 ng-style 设置 li:before 的 css [英] How to set the css of the li:before with ng-style
本文介绍了如何使用 ng-style 设置 li:before 的 css的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用可变范围(宽度)更改 li:before 的宽度值.
I want to change the width value of the li:before with a variable scope (width).
<ul>
<li ng-repeat="step in stepsList" ng-style="{li:before { 'width': width;}"
ng-class="{true: 'active'}[step.active]">
<span>{{step.stepName | uppercase}}</span>
</li>
</ul>
我正在执行此代码,但它不起作用.请帮忙.
I'm doing this code but it's not working. help please.
推荐答案
很遗憾,您不能在 内联样式
中使用 pseudoelements
.你可以做的是有两个独立的CSS Classes
,比如
Unfortunately you cannot have pseudoelements
within inline styling
. What you could do is have two sepparate CSS Classes
like
.a:before {}
.b:before {}
这样您就可以使用 ngClass 将适当的类添加到您的 HTML 中
This way you could use ngClass to add the appropriate class to your HTML
这篇关于如何使用 ng-style 设置 li:before 的 css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文