仅当我单击按钮的右侧时按钮单击才有效

Button click working only if i click right hand side of button

我的 html 中的一个按钮名称有两个文本,当我单击第二个文本时,只有按钮单击有效。需要使整个按钮可点击并在鼠标悬停时显示指针光标。

<div class="d-flex">
  <button (click)="myfunction()" type="button" class="btn btn-primary"  *ngIf="currentPath!= 
  '/users/userlist'">Car List</button>
</div>

很简单:cursor: pointer;

就像这样:

.d-flex {
  display: flex;
  justify-content: center;
  align-items: center;
}

.d-flex .btn {
  border: 1px solid #000;
  background-color: #000;
  color: #fff;
  padding: 10px;
  
  cursor: pointer;
}
<div class="d-flex">
  <button (click)="myfunction()" type="button" class="btn btn-primary"  *ngIf="currentPath!= 
  '/users/userlist'">Car List</button>
</div>

查看更多信息:https://developer.mozilla.org/en-US/docs/Web/CSS/cursor .