CSS:last-child:not(:only-child)没有按预期工作

时间:2012-12-27 08:55:48

标签: css css-selectors

目前,我有这个选择器:

.form .mid td p:last-child:not(:only-child) {
    margin-bottom: 0; 
}

它没有按预期工作。如果P

内有多个TD,我想删除保证金

1 个答案:

答案 0 :(得分:12)

如果您的td包含的不仅仅是p元素(我无法分辨,因为您没有显示标记),您可能希望使用:last-of-type和{{1而是:

:only-of-type
相关问题