Selecting the last 3 child in CSS

Hi there, I have a list that has margins bottom but I would like to have the last 3 not to have those margin bottoms, I believe this is achieavble by using nth child to select last 3…I googled and found a solution, can someone help me write this?

#something a:nth-last-child(-n+3) {

This is the code I need edited.

.TzContactInfo li {
    font-size: 16px;
    color: #aaaaaa;
    margin-bottom: 22px;
    list-style: none;
    border-bottom: 1px solid #4f4f4f;
    padding-bottom: 20px;


You were half way there.
This should do what you are wanting.

.TzContactInfo li:nth-last-child(-n+3) {
   margin-bottom: 0;

Thanks @Ray.H

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.