Use :not()
to Apply/Unapply Borders on Navigation
Instead of putting on the border…
/* add border */
.nav li {
border-right: 1px solid #666;
}
…and then taking it off the last element…
/* remove border */
.nav li:last-child {
border-right: none;
}
…use the :not()
pseudo-class to only apply to the elements you want:
.nav li:not(:last-child) {
border-right: 1px solid #666;
}
Here, the CSS selector is read as a human would describe it.
Demo
当前内容版权归 AllThingsSmitty 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 AllThingsSmitty .