小程序修改默認的單選框復選框樣式


/*radio未選中時樣式 */ 
radio .wx-radio-input {
  width: 30rpx;
  height: 30rpx;
}


/* 選中后的 背景樣式 */
radio .wx-radio-input.wx-radio-input-checked {
  border-color: #25A96D!important;
  background-color: #fff!important;
  width: 30rpx;
  height: 30rpx;
}

/* 選中后的 對勾樣式  */
radio .wx-radio-input.wx-radio-input-checked::before {
  /* 去除對號 */
  content: ''; 
  width: 24rpx;
  height: 24rpx;
  border-radius: 50%;
  background-color: #25A96D;
}

修改后展示效果

 

修改復選框默認樣式

.checkbox .wx-checkbox-input {
  border-radius: 32rpx; /* 圓角 */
  width: 32rpx; /* 背景的寬 */
  height: 32rpx; /* 背景的高 */
  border: 2px solid rgba(255, 129, 92, 1);
}

.checkbox .wx-checkbox-input-disabled {
  border-radius: 32rpx; /* 圓角 */
  width: 32rpx; /* 背景的寬 */
  height: 32rpx; /* 背景的高 */
  background: #f3f3f3;
  border: 1px solid rgba(201, 201, 201, 1);
}

.checkbox .wx-checkbox-input.wx-checkbox-input-checked {
  background: rgba(255, 129, 92, 1);
}

.checkbox  .wx-checkbox-input.wx-checkbox-input-checked::before {
  width: 32rpx;
  height: 32rpx;
  line-height: 32rpx;
  text-align: center;
  font-size: 24rpx;
  color: #fff;
  background: transparent;
  transform: translate(-50%, -50%) scale(1);
  -webkit-transform: translate(-50%, -50%) scale(1);
}

.checkbox .wx-checkbox-input {
  border-radius: 32rpx; /* 圓角 */
  width: 32rpx; /* 背景的寬 */
  height: 32rpx; /* 背景的高 */
  border: 1px solid rgba(255, 129, 92, 1);
}

.checkbox .wx-checkbox-input-disabled {
  border-radius: 32rpx; /* 圓角 */
  width: 32rpx; /* 背景的寬 */
  height: 32rpx; /* 背景的高 */
  background: #f3f3f3;
  border: 1px solid rgba(201, 201, 201, 1);
}

.checkbox .wx-checkbox-input.wx-checkbox-input-checked {
  background: rgba(255, 129, 92, 1);
}

.checkbox  .wx-checkbox-input.wx-checkbox-input-checked::before {
  width: 32rpx;
  height: 32rpx;
  line-height: 32rpx;
  text-align: center;
  font-size: 24rpx;
  color: #fff;
  background: transparent;
  transform: translate(-50%, -50%) scale(1);
  -webkit-transform: translate(-50%, -50%) scale(1);
}

原文鏈接:https://blog.csdn.net/qq_33551792/article/details/89631172


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM