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.
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; }
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.
li
a
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.
Works like a charm. Thanks…