Css 选择子标记:在元素之后,最后一个除外

Css 选择子标记:在元素之后,最后一个除外,css,Css,我有一个angular应用程序,里面有自定义组件(标签)div: <div class="parent"> <custom-1></custom-1> <custom-2></custom-2> <custom-3></custom-3> <custom-4></custom-4> </div> 似乎,*忽略了类型的:last,因为如果我这样使

我有一个angular应用程序,里面有自定义组件(标签)
div

<div class="parent">
    <custom-1></custom-1>
    <custom-2></custom-2>
    <custom-3></custom-3>
    <custom-4></custom-4>
</div>

似乎,
*
忽略了类型的
:last
,因为如果我这样使用它:
.parent>*:type的last:after
,它没有选择任何内容。

不确定您的代码,但您甚至可能不需要
*
您可以将
:last child
:after
组合在一起

.parent>:之后{
内容:“;
显示:块;
宽度:20px;
高度:20px;
保证金:5px;
背景颜色:橙色;
}
.parent>:最后一个子项:之后{
背景颜色:绿色;
}

如果可能,您可以为组件使用一个公共类,如

.parent > :after {
content: "";
display: block;
width: 20px;
height: 20px;
margin: 5px;
background-color: orange;
}


似乎我误解了
*
选择器。现在可以了,谢谢@Gabriel很高兴听到,很高兴编码!我也学到了一些新的东西,不知道*。这太棒了@Gabriel这可能是您真正想要的=>
.parent>:不是(:最后一个孩子)::在@caramba的可能重复项之后,我有自定义标记。这个问题肯定会列出标签。@Gabriel在这种情况下,它是哪种标签并不重要
.parent > :after {
content: "";
display: block;
width: 20px;
height: 20px;
margin: 5px;
background-color: orange;
}