How to style a checkbox using CSS

前端 未结 30 3449
日久生厌
日久生厌 2020-11-21 04:26

I am trying to style a checkbox using the following:

30条回答
  •  無奈伤痛
    2020-11-21 05:04

    Modify checkbox style with plain CSS3, don't required any JS&HTML manipulation.

    .form input[type="checkbox"]:before {
      display: inline-block;
      font: normal normal normal 14px/1 FontAwesome;
      font-size: inherit;
      text-rendering: auto;
      -webkit-font-smoothing: antialiased;
      content: "\f096";
      opacity: 1 !important;
      margin-top: -25px;
      appearance: none;
      background: #fff;
    }
    
    .form input[type="checkbox"]:checked:before {
      content: "\f046";
    }
    
    .form input[type="checkbox"] {
      font-size: 22px;
      appearance: none;
      -webkit-appearance: none;
      -moz-appearance: none;
    }
    
    
    

提交回复
热议问题