Last-child - doesn't want to go away, instead removes all div content!

Hi guys,

i need some help i am really getting angry… because i can’t seem to solve a problem with the last child trick.

I hav a navigation and i want to remove the “content” => | on the last element… but instead it removes my complete menu…


.border-menu a:after { 
margin-left: 8px;
font-size: 24px;
color: #17507d !important;
content: "|";
display: inline-block !important;

.border-menu a:last-child:after {
content: '';



See the top navigation… please help me!

Where is your closing bracket after display:inline-block!important;?

The anchor is the only child in that context so all the anchors in that section will always match last-child.

You need to target the last-child of the menu elements and then get throght to the anchor that way.


.border-menu:last-child li a:after{content:""}

I’m not sure why you have used ULs for all those items when they could have all been just list elements instead.

1 Like

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