Angularjs 如何设置右边框:最后一个子项的标签中无?
我有一个标签,它在我的一个div中返回许多不同的名称,下面是它在html视图中的外观Angularjs 如何设置右边框:最后一个子项的标签中无?,angularjs,html,css,sass,Angularjs,Html,Css,Sass,我有一个标签,它在我的一个div中返回许多不同的名称,下面是它在html视图中的外观 <div class="customerDisplayFlex"> <div class="" *ngFor="let cust of customers"> <label class="dataLabel"> <input type="radio" name="user-radio"
<div class="customerDisplayFlex">
<div class="" *ngFor="let cust of customers">
<label class="dataLabel">
<input type="radio"
name="user-radio"
[value]="customer"
[ngModel]="currentCustomerContext"
(click)="onCustomerContextchange(customer)"
class="dataLabel__input" />
<span class="customer__label">{{customer.firstName | titleCase}} {{ customer.lastName | titleCase}}</span>
</label>
</div>
</div>
我甚至试着用sass:
.dataLabel{
color: green;
border-right: 2px solid grey;
&:last-child{
border-right: none;
}
}
奇怪的是,这不起作用我做错了什么?能找个人帮忙吗?谢谢你试试这个
.dataLabel span:last-child{
border-right: none;
}
它真的是容器中的最后一个孩子吗?不仅是最后一个标签?。通常会有一个输入标记或类似标记 如果是最后一个标签标记,则可以使用:last of type而不是:last child 在注释之后以及在问题中添加更多代码之后添加: 如果所有.customerDisplayFlex仍在另一个容器中,该容器随后不包含任何其他内容,则该操作应能正常工作:
.customerDisplayFlex:last-child label { border-right: none; }
您不想要:last child,您想要:last of type:
.数据标签{
颜色:绿色;
右边框:2倍纯色灰色;
}
.dataLabel:类型的最后一个{
边界权:无;
}
标签1
标签2
标签3
我们实际上需要看到更多的HTML,我认为两级包装就足够了。另外,请再显示一些标签。边框已打开。dataLabel,而不是它的子跨度请参见问题中的CSS最后一个标签,:last type删除所有标签的右边框:困惑:听起来好像每个标签和输入对都在一个单独的容器中。您应该发布更多的HTML代码,但通常会使用div.label_和_input_container:last child label{border right:none;},也就是说,将最后一个子容器应用到容器上,这再次需要在容器周围使用另一个容器,其中最后一个标签确实位于最后一个子容器中。我们需要看到标签及其容器外的代码!这就是最后一个孩子或类似的孩子将要应用的地方。我们仍然需要看到外面的结构。customerDisplayFlex,但是我现在在我的回答中添加了一些东西,这可能有助于请仔细阅读我的问题:意思是你提供的解决方案,我已经说过了,也不起作用:在这里,它删除了所有正确的边框,我们只希望最后一个位于标签右侧names@HotZellah对不起,但我没读到你已经试过了,在你的问题中。无论如何,在标签之后是否有其他元素作为同级元素?
.customerDisplayFlex:last-child label { border-right: none; }