Search code examples
csswordpressrouterlink

Hide element with css based on router link


I am using a plugin of which I want to hide an element. It is about the buttons below, they both have the same class, but a different Router link, now I only want to hide on of these buttons. I am wondering wether I can call one of these elements separate from the other?

<button _ngcontent-c1="" class="mat-menu-item ng-star-inserted" mat-menu-item="" role="menuitem" routerlink="/report" tabindex="0" aria-disabled="false"> ... </button>
<button _ngcontent-c1="" class="mat-menu-item ng-star-inserted" mat-menu-item="" role="menuitem" routerlink="/orders" tabindex="0" aria-disabled="false"> ... </button>


I hope it is possible. If not, I would also like to know. Then I stop searching for a solution.

Thanks a lot.


Solution

  • You can select those elements with an attribute selector

    button[routerlink="/report"],
    button[routerlink="/orders"] {
      display: none;
    }