Style a checkbox in firefox — remove check and border

后端 未结 4 1875
说谎
说谎 2020-12-01 16:08

How do I style a checkbox in firefox, and have the checkmark and border disappear?

http://jsfiddle.net/moneylotion/qZvtY/

CSS:



        
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-01 16:47

    A cleaner solution IMHO that uses pure css to redraw the elements.

    Codepen

                    input[type="checkbox"] {
                opacity: 0;
                position: absolute;
            }
    
            input[type="checkbox"] ~ label:before {
              content: '';
              display: inline-block;
              cursor: pointer;
              ...
              border: 3px solid #999;
              border-radius: 2px;
              transition: .3s;
            }
    
            input[type="checkbox"]:checked ~ label:before {
              background: #333;
            }

提交回复
热议问题