skip to Main Content

Im using bootstrap button, then i changed the color of the button. but when i clicked the button it change to blue, even though i write .btn-primary:active

HTML:

<button type="button" class="btn btn-primary">My Button</button>

CSS:

.btn-primary {
  background-color: #ffa500;
  border: 1px solid #e39400;
}

.btn-primary:hover {
  background-color: #e39400;
  border: 1px solid #e39400;
}

.btn-primary:active {
  background-color: #e39400;
  border: 1px solid #e39400;
}

2

Answers


  1. If you want to override the default for Bootstrap, you can change .btn-primary:active to:

    .btn-primary:active {
        background-color: #e39400 !important;
        border: 1px solid #e39400;
    }
    
    Login or Signup to reply.
  2. use !imporant and it should work

    .btn-primary {
      background-color: #ffa500;
      border: 1px solid #e39400;
    }
    
    .btn-primary:hover {
      background-color: #e39400;
      border: 1px solid #e39400;
    }
    
    .btn-primary:active {
      background-color: #e39400 !important;
      border: 1px solid #e39400 !important;
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search