How to make checkboxes rounded?

后端 未结 4 1076
离开以前
离开以前 2021-02-04 03:13

Is there any way to make checkboxes with rounded corners using bootstrap or some css property?

4条回答
  •  南旧
    南旧 (楼主)
    2021-02-04 03:32

    Try to do

    body {
      background-color: #f1f2f3;
      -webkit-box-align: center;
          -ms-flex-align: center;
              align-items: center;
      display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
    }
    
    .container {
      margin: 0 auto;
    }
    
    .round {
      position: relative;
    }
    
    .round label {
      background-color: #fff;
      border: 1px solid #ccc;
      border-radius: 50%;
      cursor: pointer;
      height: 28px;
      left: 0;
      position: absolute;
      top: 0;
      width: 28px;
    }
    
    .round label:after {
      border: 2px solid #fff;
      border-top: none;
      border-right: none;
      content: "";
      height: 6px;
      left: 7px;
      opacity: 0;
      position: absolute;
      top: 8px;
      transform: rotate(-45deg);
      width: 12px;
    }
    
    .round input[type="checkbox"] {
      visibility: hidden;
    }
    
    .round input[type="checkbox"]:checked + label {
      background-color: #66bb6a;
      border-color: #66bb6a;
    }
    
    .round input[type="checkbox"]:checked + label:after {
      opacity: 1;
    }

提交回复
热议问题