how to select a specific element if both have same classname

lets say I have these two buttons
<Button class="navButton">Menu</Button>
<Button class="navButton">Restart</Button>

then how do I select the button with the text restart, menu

I tried doing this

.navButton:nth-child(1) {
  margin-left: 15%;
}

.navButton:nth-child(2) {
  margin-right: 15%;
}

button with menu text is selecting but restart is not selecting
Was this page helpful?