复选框Mozilla跨浏览器问题 [英] Checkboxes Mozilla Cross-Browser issue

查看:269
本文介绍了复选框Mozilla跨浏览器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mozilla上的复选框遇到一些问题。复选框(位于 http://apespark.com/formifyPro/examples/login.html )在Chrome上可以正常使用,但在Mozilla上看起来像默认复选框。我尝试并添加了 -moz-appeareance:none ,但是似乎它没有读取伪(($code> :: before 和 :: after )元素。我真的不明白,也不明白为什么它没有按预期显示。

I'm experiencing some issues with my checkboxes on Mozilla. The checkbox (on http://apespark.com/formifyPro/examples/login.html) works totally fine on Chrome, but on Mozilla it looks like the default checkbox. I tried and added-moz-appeareance: none, but as it seems it's not reading the pseudo (::before and ::after) elements. I really can't understand and see why it's not displaying as supposed to.

推荐答案

您应该设置标签样式而不是输入样式

you should style your label and not the input field.

label {
    display: inline-block;
    cursor: pointer;
    // your styles here for text.

}
label:before {
    content:"";
    // styles here for the actual checkbox
}
input[type=checkbox] {
    display: none;
}
input[type=checkbox]:checked + label:before {
    content:"";
    // styles here when checkbox is checked
}

为了安全起见应该从包装标签更改HTML,就像您有

to be safe you should change your html from a wrapping label like you have

<label><input /></label>

到这样的引用对象

<input id="myInput" />
<label for="myInput"></label>

问候timotheus

greetings timotheus

这篇关于复选框Mozilla跨浏览器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆