css多选框checkbox样式
- 作者: 五速梦信息网
- 时间: 2026年03月19日 18:19
css多选框checkbox样式
更新日期: 2022-05-16 分享
复制链接
新浪微博
QQ 好友
扫一扫分享
<div class=“container”>
<!– TITLE –>
<span class=“title”>
css Material Design checkbox
</span>
<!– CHECKBOXES –>
<div class=“checkbox”>
<input type=“checkbox” id=“checkbox1” class=“checkboxinput” checked>
<label for=“checkbox1” class=“checkboxlabel”>Checkbox 1</label>
</div><br>
<div class=“checkbox”>
<input type=“checkbox” id=“checkbox2” class=“checkboxinput”>
<label for=“checkbox2” class=“checkboxlabel”>Checkbox 2</label>
</div><br>
<div class=“checkbox”>
<input type=“checkbox” id=“checkbox3” class=“checkboxinput”>
<label for=“checkbox3” class=“checkboxlabel”>Checkbox 3</label>
</div><br>
</div>
<style>
body, html {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: Roboto, sans-serif;
width: 100%;
background: #fafafa;
color: #757575;
}
*, *:before, *:after {
box-sizing: inherit;
}
.container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.title {
display: block;
margin: 0 0 20px;
font-size: 24px;
text-transform: uppercase;
}
.checkbox {
display: inline-block;
position: relative;
margin: 0 0 10px;
font-size: 16px;
line-height: 24px;
}
.checkboxinput {
position: absolute;
top: 4px;
left: 0;
width: 16px;
height: 16px;
opacity: 0;
z-index: 0;
}
.checkboxlabel {
display: block;
padding: 0 0 0 24px;
cursor: pointer;
}
.checkboxlabel:before {
content: ‘’;
position: absolute;
top: 4px;
left: 0;
width: 16px;
height: 16px;
background-color: transparent;
border: 2px solid rgba(0, 0, 0, 0.54);
border-radius: 2px;
z-index: 1;
transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
transition-property: background-color, border-color;
}
.checkboxlabel:after {
content: ‘’;
position: absolute;
top: 5px;
left: 5px;
width: 6px;
height: 12px;
border-bottom: 2px solid transparent;
border-right: 2px solid transparent;
transform: rotate(45deg);
z-index: 2;
transition: border-color 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
.checkboxinput:checked + .checkboxlabel:before {
background-color: #3f51b5;
border-color: #3f51b5;
}
.checkboxinput:checked + .checkboxlabel:after {
border-color: #fff;
}
</style>
- 上一篇: Sitemap URL网址提取器(sitemap链接获取工具)
- 下一篇: Robots文件生成器
相关文章
-
Sitemap URL网址提取器(sitemap链接获取工具)
Sitemap URL网址提取器(sitemap链接获取工具)
- 互联网
- 2026年03月19日
-
无脂肪质量指数计算(FFMI肌肉水平计算器)
无脂肪质量指数计算(FFMI肌肉水平计算器)
- 互联网
- 2026年03月19日
-
css实现手风琴效果
css实现手风琴效果
- 互联网
- 2026年03月19日
-
Robots文件生成器
Robots文件生成器
- 互联网
- 2026年03月19日
-
全国普通高等学校名单查询工具
全国普通高等学校名单查询工具
- 互联网
- 2026年03月19日
-
Baidu百度高级搜索工具
Baidu百度高级搜索工具
- 互联网
- 2026年03月19日








