Using LESS I need to remove an :after property within an element's :last-child.
li {
&:after {
content: '/';
}
&:last-child {
&:after {
content: '';
}
}
}
This is obviously not correct nesting - what am I missing?
It looks correct to me, but if it's not working then try not nesting that second :after
:
li {
&:after {
content: '/';
}
&:last-child:after {
content: '';
}
}
If you mean that the :after
pseudo-element still displays for the last child, then you'll definitely want to change content: '';
to content: none;
instead. An empty string will still cause an empty box to be generated, while none
generates no box.
You can use also:
li {
&:not(:last-child):after {
content: " | ";
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With