我有一个有角度的应用程序,在其中有自定义组件(标签)div
:
我想选择所有子标签的:after
内部.parent
,因此我可以在组件之间创建分隔线,除了最后一个之后。
目前,我只选择了所有:
.parent > *:after { content: ""; height: 60%; width: 1px; background-color: black; position: absolute; right: 0; top: 5px; }
看来,这*
是在忽略:last-of-type
,因为如果我这样使用它:.parent > *:last-of-type:after
,它什么也不会选择。
不确定您的代码,但您甚至可能不需要将其*
组合在一起:last-child
,:after
就像这样
.parent > :after {
content: "";
display: block;
width: 20px;
height: 20px;
margin: 5px;
background-color: orange;
}
.parent > :last-child:after {
background-color: green;
}