gpt4 book ai didi

css - 在移动设备上查看时缺少自定义 CSS 复选框边距

转载 作者:太空宇宙 更新时间:2023-11-04 11:20:28 25 4
gpt4 key购买 nike

我有一个用 CSS 编写的自定义复选框,在开发中看起来符合预期。但是当它在移动设备上(通过 Heroku)查看时,右边距不会显示,如下所示:

enter image description here

知道为什么在 CSS 中正确设置右边距后它会消失吗?

自定义复选框 CSS:

input[type="checkbox"],
.checkbox input[type="checkbox"],
.checkbox-inline input[type="checkbox"] {
position: relative;
border: none;
margin-bottom: -4px;
-webkit-appearance: none;
appearance: none;
cursor: pointer;
}
input[type="checkbox"]:focus,
.checkbox input[type="checkbox"]:focus,
.checkbox-inline input[type="checkbox"]:focus {
outline: none;
}
input[type="checkbox"]:after,
.checkbox input[type="checkbox"]:after,
.checkbox-inline input[type="checkbox"]:after {
content: "";
display: block;
width: 18px;
height: 18px;
margin-top: -2px;
margin-right: 1rem;
border: 2px solid #8D8D8D;
border-radius: 4px;
-webkit-transition: 240ms;
-o-transition: 240ms;
transition: 240ms;
}
input[type="checkbox"]:checked:before,
.checkbox input[type="checkbox"]:checked:before,
.checkbox-inline input[type="checkbox"]:checked:before {
content: "";
position: absolute;
top: 0;
left: 6px;
display: table;
width: 6px;
height: 12px;
border: 2px solid #fff;
border-top-width: 0;
border-left-width: 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
input[type="checkbox"]:checked:after,
.checkbox input[type="checkbox"]:checked:after,
.checkbox-inline input[type="checkbox"]:checked:after {
background-color: #00B1FF;
border-color: #00B1FF;
}
input[type="checkbox"]:disabled:after,
.checkbox input[type="checkbox"]:disabled:after,
.checkbox-inline input[type="checkbox"]:disabled:after {
border-color: #DFDFDF;
}
input[type="checkbox"]:disabled:checked:after,
.checkbox input[type="checkbox"]:disabled:checked:after,
.checkbox-inline input[type="checkbox"]:disabled:checked:after {
background-color: #DFDFDF;
border-color: transparent;
}
.has-warning input:not([type=checkbox]),
.has-warning .form-control,
.has-warning input.form-control[readonly],
.has-warning input[type=text][readonly],
.has-warning [type=text].form-control[readonly],
.has-warning input:not([type=checkbox]):focus,
.has-warning .form-control:focus {
border-bottom: none;
-webkit-box-shadow: inset 0 -2px 0 #FFD200;
box-shadow: inset 0 -2px 0 #FFD200;
}
.has-error input:not([type=checkbox]),
.has-error .form-control,
.has-error input.form-control[readonly],
.has-error input[type=text][readonly],
.has-error [type=text].form-control[readonly],
.has-error input:not([type=checkbox]):focus,
.has-error .form-control:focus {
border-bottom: none;
-webkit-box-shadow: inset 0 -2px 0 #FF193C;
box-shadow: inset 0 -2px 0 #FF193C;
}
.has-success input:not([type=checkbox]),
.has-success .form-control,
.has-success input.form-control[readonly],
.has-success input[type=text][readonly],
.has-success [type=text].form-control[readonly],
.has-success input:not([type=checkbox]):focus,
.has-success .form-control:focus {
border-bottom: none;
-webkit-box-shadow: inset 0 -2px 0 #00FFD2;
box-shadow: inset 0 -2px 0 #00FFD2;
}
.has-warning .input-group-addon,
.has-error .input-group-addon,
.has-success .input-group-addon {
color: #F8F8F8;
border-color: transparent;
background-color: transparent;
}

最佳答案

我的 friend 提供了答案。关键是移动线:

margin-right: 1rem;

到第一个 block :

input[type="checkbox"],
.checkbox input[type="checkbox"],
.checkbox-inline input[type="checkbox"] {
position: relative;
border: none;
margin-bottom: -4px;
margin-right: 1rem;
-webkit-appearance: none;
appearance: none;
cursor: pointer;
}

我还将 display: table 更改为 display: block

现在一切看起来都如愿。

关于css - 在移动设备上查看时缺少自定义 CSS 复选框边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32828709/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com