【发布时间】:2020-12-27 11:51:17
【问题描述】:
我正在尝试为复选框实现波纹效果,但它没有准确显示,波纹效果宽度变得太大,下面是我尝试过的代码。我需要一个带有浅色背景的小宽度波纹效果,我想我错过了一些样式。谁能帮我解决这个问题,在此先感谢
.checkbox label {
display: inline-block;
vertical-align: middle;
position: relative;
padding-left: 5px;
}
.checkbox label::before {
content: "";
display: inline-block;
position: absolute;
width: 18px;
height: 18px;
left: 2px;
top: 0px;
margin-left: -20px;
border: 1px solid #ccc;
border-radius: 2px;
background-color: #fff;
-webkit-transition: border 0.15s ease-in-out, color 0.15s ease-in-out;
-o-transition: border 0.15s ease-in-out, color 0.15s ease-in-out;
transition: border 0.15s ease-in-out, color 0.15s ease-in-out;
}
.checkbox label::after {
display: inline-block;
position: absolute;
width: 16px;
height: 16px;
left: 1px;
top: 1px;
font-weight: 100;
margin-left: -18px;
padding-left: 3px;
padding-top: 1px;
font-size: 11px;
color: #555;
}
.cbox-table label::after,
.cbox-table label::before {
margin-left: 0px;
}
.checkbox input[type="checkbox"],
.checkbox input[type="radio"] {
opacity: 0;
z-index: 1;
cursor: pointer;
}
.checkbox input[type="checkbox"]:indeterminate + label::after,
.checkbox input[type="radio"]:indeterminate + label::after {
display: block;
content: "";
width: 10px;
height: 3px;
background-color: #555;
border-radius: 2px;
margin-left: -16.5px;
margin-top: 7px;
}
.checkbox input[type="checkbox"]:disabled + label,
.checkbox input[type="radio"]:disabled + label {
opacity: 0.65;
}
.checkbox input[type="checkbox"]:disabled + label::before,
.checkbox input[type="radio"]:disabled + label::before {
background-color: #eee;
cursor: not-allowed;
}
.checkbox.checkbox-circle label::before {
border-radius: 50%;
}
.checkbox.checkbox-inline {
margin-top: 0;
}
.checkbox-warning input[type="checkbox"]:checked + label::before,
.checkbox-warning input[type="radio"]:checked + label::before {
background-color: #007bff;
border-color: #007bff;
}
.checkbox-warning input[type="checkbox"]:checked + label::after,
.checkbox-warning input[type="radio"]:checked + label::after {
color: #fff;
}
.checkbox-warning input[type="checkbox"]:indeterminate + label::before,
.checkbox-warning input[type="radio"]:indeterminate + label::before {
background-color: #007bff;
border-color: #007bff;
}
.checkbox-warning input[type="checkbox"]:indeterminate + label::after,
.checkbox-warning input[type="radio"]:indeterminate + label::after {
background-color: #fff;
}
.checkbox input[type="checkbox"]:checked + label::after {
font-family: "FontAwesome";
content: "\f00c";
}
input[type="checkbox"]:focus+label::before {
animation: ripple 1s ease-out;
}
@keyframes ripple {
0% {
transform: scale(0, 0);
opacity: 1;
}
20% {
transform: scale(25, 25);
opacity: 1;
}
100% {
opacity: 0;
transform: scale(40, 40);
}
}
<div class="form-check form-check-inline checkbox checkbox-warning checkbox-inline pl-0 text-left">
<input class="form-check-input" type="checkbox" id="check1" name="enquiry" >
<label class="form-check-label label-font" for="inlineCheckbox1">Approved Leaves</label>
</div>
【问题讨论】:
-
感谢您的回复...我想在整个应用程序中应用涟漪效果,您能帮我看看我的代码中的错误在哪里吗?我想在样式表中添加代码只是,所以如果可能的话,请你更新我的代码..iam 试图保持像这样codepen.io/lehollandaisvolant/pen/GqmBGA 的涟漪效应,但我没有得到准确
标签: html css checkbox radio ripple