checkbox 背景图片 纯CSS处理办法

CSS

 

 .table_container input[type="checkbox"] {
   background: #fff url(/img/blue.png);
   background: none;
   *background: none;
 }

 .table_container .checkbox {
  min-height: 20px;
  padding-left: -20px;
  position: relative;
}
.table_container input[type="checkbox"]:checked + label:before,
.table_container input[type="checkbox"]:not(:checked) + label:before {
  background: #fff url(/img/blue.png);
  content: " ";
  height: 20px;
  left: 0;
  position: absolute;
  width: 20px;
}
.table_container input[type="checkbox"]:checked + label:before {
  background-position: -22px 0;
}

.table_container input[type="checkbox"][disabled]:not(:checked) + label:before {
  background-position: -44px 0;
}
.table_container input[type="checkbox"][disabled]:checked + label:before {
  background-position: -66px 0;
}

HTML

<div class="checkbox">
                <input type="checkbox" name="table_cbox" id="table_cbox"  />
                <label for="table_cbox"></label>
            </div>

posted on 2015-06-03 19:42  shenggen  阅读(2247)  评论(0编辑  收藏  举报

导航