按钮在被点击后保持按下状态

A button remains in pressed state after being clicked

我正在开发可重复使用的按钮。我遇到的问题是按钮在单击后没有获得其原始样式。这是 LESS 文件的快照:

.some-company-primary-button {
  .material;

  color: @some-company-primary-button-text-color;
  background: @some-company-primary-button-color;

  &:hover,
  &:focus,
  &:active,
  &.focus,
  &.active {
    color: @some-company-primary-button-text-color;
    background: @some-company-primary-button-hover-color;
  }
}

感谢您的任何想法!

编辑 我正在使用它 Bootstrap btn class

假设你的意思是 "doesn't get its original style until something else is clicked":

更改 :focus 规则。

单击某个控件将为其提供焦点,直到其他东西将焦点移到其他地方。