如何按角度按伪类应用?
我有以下CSS
#auction-history div:after {
content: "";
width: 100%;
height: 8px;
position: absolute;
bottom: -8px;
background: #bad3e0;
left: 0;
}
此CSS始终应用于我的DIV。
我需要基于布尔值的HTML中将此假类带有条件。
因此,当我
isLoading = true or false
需要绑定时,加载属性,如果它是真的 - 我不想在我的div上添加thius pseudeo class,如果是错误的,我需要应用
我知道我可以在Angular上应用类带有ngclass
的条件,但我不知道该如何使用伪类进行此操作。
I have the following css
#auction-history div:after {
content: "";
width: 100%;
height: 8px;
position: absolute;
bottom: -8px;
background: #bad3e0;
left: 0;
}
this css will be applied always on my div.
I need to have this pseudoclass on condition in my Html based on boolean.
So when i have
isLoading = true or false
i need to bind to this is loading property and if it is true - I don't want to appky thius pseudeo class on my div if it is false I need to apply
I know that I can apply classes in Angular on condition with ngClass
but I don't know how can i do this with pseudo classes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
::之后
来创建一个其他类来处理此操作。示例:
html
css
stackbiltz demo
You can create a additional class with
::after
to handle this.Example:
HTML
CSS
StackBiltz Demo
只需“重新考虑”您的CSS,例如您可以使用“
您的.html
或简单的类
注:您可以使用
[ngclass]
或[ngstyle]
或[style.property] =“变量”
或[class.classname] =“ variable”
Just "re-think" your css, e.g. you can use "not"
Your .html
or a simple class
NOTE: You can use
[ngClass]
or[ngStyle]
or[style.property]="variable"
or[class.classname]="variable"