How to change the button color when it is active using bootstrap?

后端 未结 3 1192
礼貌的吻别
礼貌的吻别 2020-12-17 09:56

I am using bootstrap 3. I want to change button color when I click on button.I mean button should be in different color when it is selected. How can I do this using css?

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-17 10:32

    CSS has many pseudo selector like, :active, :hover, :focus, so you can use.

    Html

    css

    .btn{
        background: #ccc;
    } .btn:focus{
        background: red;
    }
    

    JsFiddle

提交回复
热议问题