Bootstrap Button active color change

前端 未结 3 906
挽巷
挽巷 2021-02-14 06:20

I\'m using the bootstrap button class, more specifically the following :


         


        
3条回答
  •  情书的邮戳
    2021-02-14 07:01

    The default color for btn-success is #5cb85c. All you have to do is inspect it with DevTools or search your bootstrap stylesheet to find all the rules that pertain to this class and change whatever you need in your own stylesheet to override them. No need to use !important at all, specificity is your friend. See MDN Specificity.

    See working Snippet (This example changed all states to the same base color just as an example and also removes the box-shadow property as well. You should be able to change whatever you need from here.)

    .btn.btn-success {
      color: #fff;
      background-color: #5cb85c;
      border-color: #5cb85c;
    }
    .btn.btn-success.focus,
    .btn.btn-success:focus {
      color: #fff;
      background-color: #5cb85c;
      border-color: #5cb85c;
      outline: none;
      box-shadow: none;
    }
    .btn.btn-success:hover {
      color: #fff;
      background-color: #5cb85c;
      border-color: #5cb85c;
      outline: none;
      box-shadow: none;
    }
    .btn.btn-success.active,
    .btn.btn-success:active {
      color: #fff;
      background-color: #5cb85c;
      border-color: #5cb85c;
      outline: none;
    }
    .btn.btn-success.active.focus,
    .btn.btn-success.active:focus,
    .btn.btn-success.active:hover,
    .btn.btn-success:active.focus,
    .btn.btn-success:active:focus,
    .btn.btn-success:active:hover {
      color: #fff;
      background-color: #5cb85c;
      border-color: #5cb85c;
      outline: none;
      box-shadow: none;
    }
    
    

提交回复
热议问题