I'm trying to select the first and last child of an element with a specific data-
attribute.
The :first-child
selector works fine, but :last-child
isn't working. I seriously don't know what can cause this. I have checked for typos.
CSS
.element[data-type='element']:first-child {
padding-left: 0;
background-color:red !important
}
.element[data-type='element']:last-child {
padding-right: 0;
border-right:0;
background-color:red !important;
}
See Question&Answers more detail:os