Forums

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

Home Forums CSS [Solved] .last-child selector overrides all.

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #198891
    css_fan5
    Participant

    Hello everyone,

    I have a bunch of a tags and I would like to remove the right border form the last one. I have tried the last-child selector but it doesn´t work. Any suggestions???

    .genesis-nav-menu a {
    border-right: 1px solid #e3e3e3;
    color: #006187;
    display: block;
    padding: 14px 24px;
    padding: 1.4rem 2.4rem;
    position: relative;
    font-size: 1.7rem;
    }

    .genesis-nav-menu a:last-child {
    border-right: none;
    }

    #198896
    Paulie_D
    Member

    My guess is that the anchors are inside li…in which case every a will be the last child of the li that holds it.

    What I suspect you need is

    .genesis-nav-menu li:last-child a{
    border-right: none;
    }
    

    Otherwise we’d need to see the HTML & CSS in a Codepen demo.

    #198897
    css_fan5
    Participant

    Works like a charm. Thanks…

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