css - last-child不起作用
黄舟
黄舟 2017-04-17 11:57:39
[CSS3讨论组]

@{ var listExecution = Model.listtaskexecution; if (listExecution != null && listExecution.Count > 0) { foreach (var item in Model.listtaskexecution) { } } }
任务执行人 完成状态 完成时间
@(item.executbyname == null ? "" : item.executbyname) @(item.executon == null ? "待完成" : "已完成") @(item.executon)
@{ if (Model.listtaskexecution != null && Model.listtaskexecution.Count > 0) { foreach (var exectionItem in Model.listtaskexecution) {

@exectionItem.executbyname

@exectionItem.executon

@exectionItem.executiondescription

@{ if (exectionItem.listimgurl != null && exectionItem.listimgurl.Count > 0) { foreach (var imgItem in exectionItem.listimgurl) {

} } }

} } }

#taskContainer .operatorDetail:nth-last-child(1){
  border-bottom:none;
}


全选出了了啊 为什么啊

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

全部回复(2)
高洛峰

The :nth-last-child(an+b) CSS pseudo-class matches an element that has an+b-1 siblings after it in the document tree, for a given positive or zero value for n, and has a parent element.

先看定义,nth 这种都是选择同级别最后一个元素。但是看你的结构是这样的:

.clearfix>.operatorDetail
.clearfix>.operatorDetail
.clearfix>.operatorDetail

目标元素 .operatorDetail 都没有兄弟节点,是唯一一个,也就是全都是最后一个。所以就全被选中了。

PHPz

因为nth-last-child相对于的是父级标签的元素位置。


你的选择器的意思就是选中所有clearfix下倒数第一个子元素,而且类名是operatorDetail

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号