Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS :last-child:not(:only-child) not working as expected

Currently, I have this selector:

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

It's not working as intended. I want to remove the margin ONLY if there are more than one P inside the TD

like image 937
pocesar Avatar asked Dec 27 '12 08:12

pocesar


1 Answers

If your td contains more than just p elements (I can't tell because you haven't shown your markup), you probably want to use :last-of-type and :only-of-type instead:

.form .mid td p:last-of-type:not(:only-of-type) {
    margin-bottom: 0; 
}
like image 54
BoltClock Avatar answered Sep 21 '22 15:09

BoltClock