Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use ​ in css: not () applies / cancels applying borders on menus

Shulou Source: shulou.com Published: 2022-06-01 07:06:26 09月30日 Update

Editor to share with you how to use css: not () on the menu to apply / cancel the application frame, I believe that most people do not understand, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Use: not () to apply / unapply borders on menus

Add a border to each menu item first

/ * add border * / .nav li {border-right: 1px solid # 666;}

And then remove the last element.

/ / remove border /. Nav li:last-child {border-right: none;}

You can directly use the: not () pseudo class to apply the element:

.nav li:not (: last-child) {border-right: 1px solid # 666;}

This makes the code clean, easy to read, and easy to understand.

Of course, if your new element has a sibling element, you can also use the general sibling selector (~):

Nav li:first-child ~ li {border-left: 1px solid # 666;} above is all the content of the article "how to use css: not () applies / removes applying borders on menus". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Applications menus borders elements articles brothers content clean not so much code most more knowledge industry information information channels channels Singapore dollars reference learning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Shulou Tech Info Redmi macOS vpn