一、自定义复选框按钮
html:
<label>
<input class="mui-checkbox checkbox-green" type="checkbox" name="all" id="all">
</label>
css:
.mui-checkbox {
margin-top: 26px;
float: left;
-webkit-appearance: none;
position: relative;
width: 22px;
height: 22px;
margin-right: 10px;
border: solid 1px #666666;
background-clip: padding-box;
display: inline;
} //复选框大小
.mui-checkbox:focus {
outline: 0 none;
outline-offset: -2px;
}
.mui-checkbox:checked {
background-color: white;
border: solid 1px #ff8100;
} //复选框点中时的边框颜色变化
.mui-checkbox.checkbox-green:checked {
background-image: no-repeat;
background-size: 20px 20px;
} //复选框选中后,替换背景图片的大小
.checkbox-green:checked{
background-image: url(../../img/shixi.png);
} //选中样式背景
.mui-checkbox:checked:before {
display: inline-block;
margin-top: 1px;
margin-left: 2px;
width: 25px;
height: 25px;
font-size: 18px;
}
只兼容谷歌浏览器
html:
<div class="back">
<input class="mui-checkbox checkbox-green" type="checkbox" name="abatement" >
<label></label>
</div>
css
.xiur li input[name='abatement']:not(old) + label{
margin-top: 10px;
/* float: left;*/
margin-left: 5px;
/* -webkit-appearance: none;*/
position: relative;
width: 60px;
height: 18px;
margin-right: 10px;
background-clip: padding-box;
background-image: url(../img/choose/dedui.png);
background-size: 60px 18px;
}
.mui-checkbox{
background-image: url(../img/choose/dedui.png);
background-size: 60px 18px;
opacity: 0;
}
.mui-checkbox:focus {
outline: 0 none;
outline-offset: -2px;
opacity: 0;
}
.mui-checkbox:checked {
background-color: white;
}
.mui-checkbox.checkbox-green:checked {
background-size: 60px 18px;
opacity: 0;
}
.xiur li input[name='abatement']:checked + label {
background-image: url(../img/choose/dedu.png);
}
.mui-checkbox:checked:before {
display: inline-block;
margin-top: 1px;
margin-left: 2px;
width: 1.44rem;
height: .36rem;
}
兼容谷歌、火狐等浏览器
二、三角矩形框
:before {
content:"";
right: 100%;
margin-top: 11%;
width: 0;
height: 5px;
border-top: 13px solid transparent;
border-right: 31px solid #F1F1F1;
border-bottom: 13px solid transparent;
float: left;
margin-left: -31px;
}
三、渐变色
渐变色
从左上角到右下角的线性渐变:
#grad {
background: -webkit-linear-gradient(left top, red , blue); /* Safari 5.1 - 6.0 */
background: -o-linear-gradient(bottom right, red, blue); /* Opera 11.1 - 12.0 */
background: -moz-linear-gradient(bottom right, red, blue); /* Firefox 3.6 - 15 */
background: linear-gradient(to bottom right, red , blue); /* 标准的语法 */
}