Reputation:
How do I delete the background of my last DIV using class="item"
?
Parent is: <div id="lastQuestions"></div>
Upvotes: 0
Views: 103
Reputation: 21214
Alternatively, you could use a different html tag (like span
, p
or li
displayed as block) for the.item
elements instead of div
to differentiate them from other div
elements, and then you can do something like:
#lastQuestions li:last-of-type {
background: none;
}
to select it.
Since, according to your jsfiddle, only .item
elements are of type div
in your code they already differ in type from all other children of #lastQuestions
. So you can just try this:
#lastQuestions > div:last-of-type {
background: none;
}
Upvotes: 0
Reputation:
.item:last-child {
background-color: inherit;
}
Use pseudo element last-child
Here is a working jsfiddle
Upvotes: 4