1. 程式人生 > 其它 >小程式-修改radio及checkbox的選中背景色

小程式-修改radio及checkbox的選中背景色

一:將預設多選框checkbox的預設選中背景紅色改為綠色

checkbox .wx-checkbox-input{

  border-radius:50%;

  width:20px;height:20px;

}
checkbox .wx-checkbox-input.wx-checkbox-input-checked{

  border-color:#07c160 !important;

  background:#07c160 !important;

}
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before{

  border-radius:50%;

  width:20px;

  height:20px;

  line-height:20px;

  text-align:center;

  font-size:15px;

  color:#fff;

  background:transparent;

  transform:translate(-50%, -50%) scale(1);

  -webkit-transform:translate(-50%, -50%) scale(1);

}

  

二:將radio預設選中的紅色改為綠色

radio .wx-radio-input{

  border-radius:50%;

  width:20px;

height:20px; } radio .wx-radio-input.wx-radio-input-checked{ border-color:#07c160 !important; background:#07c160 !important; } radio .wx-radio-input.wx-radio-input-checked::before{ border-radius:50%; width:20px; height:20px; line-height:20px; text-align:center; font-size:15px; color:#fff; background:transparent; transform:translate(-50%, -50%) scale(1); -webkit-transform:translate(-50%, -50%) scale(1); }