gpt4 book ai didi

html - 自定义 CSS3 复选框在 Firefox 或 IE 上不起作用

转载 作者:搜寻专家 更新时间:2023-10-31 08:56:24 26 4
gpt4 key购买 nike

fiddle :http://jsfiddle.net/V98W8/

我有一个自定义复选框,它在 Chrome 中看起来和工作得很好,但不知何故在 Firefox 或 IE 中显示完全损坏。

我已经尝试添加自定义前缀和所有内容,但它似乎并没有解决问题。

#milestone-table input[type="checkbox"] {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-color: #fafafa;
border: 1px solid lightgrey;
border-radius: 26px;

-webkit-box-shadow: inset 0 0 0 1px lightgrey;
box-shadow: inset 0 0 0 1px lightgrey;
cursor: pointer;
height: 28px;
position: relative;

-webkit-transition: border .25s .15s, box-shadow .25s .3s, padding .25s;
-moz-transition: border .25s .15s, box-shadow .25s .3s, padding .25s;
-o-transition: border .25s .15s, box-shadow .25s .3s, padding .25s;
-ms-transition: border .25s .15s, box-shadow .25s .3s, padding .25s;
transition: border .25s .15s, box-shadow .25s .3s, padding .25s;
width: 54px;
vertical-align: top;
outline: none;
}

#milestone-table .controls input[type="checkbox"] {
margin-top: 10px;
}

#add-milestone {
position: relative;
top: 7px;
left: 90%;
}

#milestone-table {
margin-top: -20px;
}

#milestone-table input[type="checkbox"]:after {
background-color: white;
border: 1px solid lightgrey;
border-radius: 24px;

-webkit-box-shadow: inset 0 -3px 3px rgba(0, 0, 0, 0.025), 0 1px 4px rgba(0, 0, 0, 0.15), 0 4px 4px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 -3px 3px rgba(0, 0, 0, 0.025), 0 1px 4px rgba(0, 0, 0, 0.15), 0 4px 4px rgba(0, 0, 0, 0.1);
content: '';
display: block;
height: 24px;
left: 0;
position: absolute;
right: 26px;
top: 0;

-webkit-transition: border .25s .15s, left .25s .1s, right .15s .175s;
-moz-transition: border .25s .15s, left .25s .1s, right .15s .175s;
-o-transition: border .25s .15s, left .25s .1s, right .15s .175s;
-ms-transition: border .25s .15s, left .25s .1s, right .15s .175s;
transition: border .25s .15s, left .25s .1s, right .15s .175s;
}

#milestone-table input[type="checkbox"]:checked {
border-color: #53d76a;

-webkit-box-shadow: inset 0 0 0 13px #53d76a;
box-shadow: inset 0 0 0 13px #53d76a;
padding-left: 18px;

-webkit-transition: border .25s, box-shadow .25s, padding .25s .15s;
-moz-transition: border .25s, box-shadow .25s, padding .25s .15s;
-o-transition: border .25s, box-shadow .25s, padding .25s .15s;
-ms-transition: border .25s, box-shadow .25s, padding .25s .15s;
transition: border .25s, box-shadow .25s, padding .25s .15s;
}

#milestone-table input[type="checkbox"]:checked:after {
border-color: #53d76a;
left: 26px;
right: 0;

-webkit-transition: border .25s, left .15s .25s, right .25s .175s;
-moz-transition: border .25s, left .15s .25s, right .25s .175s;
-o-transition: border .25s, left .15s .25s, right .25s .175s;
-ms-transition: border .25s, left .15s .25s, right .25s .175s;
transition: border .25s, left .15s .25s, right .25s .175s;
}

最佳答案

遗憾的是,这是 Firefox 中的一个老错误,据我所知还没有修复。如果他们最近没有改变这一点(从你的问题来看,他们没有改变),无论你做什么,样式复选框和单选按钮都无法在 Firefox 中正常工作。

通常,解决此问题的一种常见方法是简单地使用常规 div 并让它们通过 javascript 或类似工具切换隐藏字段。绝对不是一个很好的解决方案,但在他们修复此错误之前,您无能为力。

我做了 a quick example使用隐藏的复选框和标签至少可以实现某些功能。当然,它不如仅使用常规输入标签那么漂亮,但它应该可以在 Firefox 中运行(我猜是 IE,但我还没有测试过)。

<div id="milestone-table">
<p>Checkbox</p>
<label>
<input type="checkbox"/>
<label class="checkbox"/>
</label>
</div>

关于html - 自定义 CSS3 复选框在 Firefox 或 IE 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19693872/

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