Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] ::after selector, get rid of last item ::after selector

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #183342
    Marcus Tisäter
    Participant

    Hello,

    I’m new to this forum/community so hopefully I’m sticking to the right forum topic. Anyway.. I’m pretty new to this ::after ::before element stuff and I was was wondering how I would fix this.

    http://codepen.io/anon/pen/xhACJ

    I want the last a tag element do not display the ::after content ‘ , ‘ .

    How do I make this possible? I heard there is a magic css trick to this without adding classes.

    #183343
    trongnguyen24
    Participant

    Hi marcustis,

    You can user this CSS

    #list a {
    padding-right: 5px;
    color: blue;
    text-decoration: none;

    }
    #list a:last-child::after {
    content: ”
    }

    #list a::after {
    content: ‘ , ‘
    }

    #183344
    Marcus Tisäter
    Participant

    Thanks that is what I was looking for.
    #list a:last-child::after {
    content: ”
    }

    #list a::after {
    content: ‘ , ‘
    }

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.