Change Bootstrap 4 checkbox background color

前端 未结 3 945
心在旅途
心在旅途 2020-12-28 15:01

I\'m wondering how can I change Bootstraps 4 checkbox background color on this given example.

    

        
3条回答
  •  轮回少年
    2020-12-28 15:15

    I'd like to add an answer here that's a bit simpler and more generic version of knetsi's answer, for those who may not be interested in making the color change contingent on the :checked pseudo-class.

    I simply wanted to define a class my-error that I can add or remove to the checkbox to change its color, in this case to reflect an error condition. The color stays the same whether the box is checked or not.

    Here's how it looks in code:

    
    
    
    
    

提交回复
热议问题