【发布时间】:2020-01-05 05:41:58
【问题描述】:
我有一个 Angular 应用程序,其中 div 中有自定义组件(标签):
<div class="parent">
<custom-1></custom-1>
<custom-2></custom-2>
<custom-3></custom-3>
<custom-4></custom-4>
</div>
我想在.parent 中选择所有子标签的:after,所以我可以在组件之间创建一条分隔线,除了最后一个之后。
目前我只选择了所有:
.parent > *:after {
content: "";
height: 60%;
width: 1px;
background-color: black;
position: absolute;
right: 0;
top: 5px;
}
似乎* 忽略了:last-of-type,因为如果我这样使用它:.parent > *:last-of-type:after,它不会选择任何东西。
【问题讨论】:
-
.parent > :not(:last-child)::after -
@caramba 我有自定义标签。该问题必然会列出标签。
-
@Gabriel 在这种情况下,它是哪种标签并不重要
标签: css