【发布时间】:2016-10-01 22:46:29
【问题描述】:
我使用 FontAwesome 自定义了我的复选框,但它仅适用于 Chrome...
我把这个放在我的页面上:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" />
<input type="checkbox" id="checkbox_cd" class="custom-checkbox" />
这是我的css:
/*
input.custom-checkbox {
visibility: hidden;
}
*/
input.custom-checkbox:checked::after, input.custom-checkbox::after {
visibility: visible;
font-family: FontAwesome;
font-size: 60px;
background-color: transparent;
display: inline-block;
}
input.custom-checkbox:checked::after {
content: '\f058';
color: #16A085;
}
input.custom-checkbox::after {
content: '\f057';
color: #C0392B;
position: relative;
bottom: 5px;
}
谢谢,
【问题讨论】:
-
您不能使用复选框的
::after。请改用<label>。 -
谢谢,可惜 ::after Firefox 不支持它..
-
不仅仅是火狐。它不适用于符合标准的任何浏览器。它可以在 Chrome 上运行是侥幸!
标签: css google-chrome firefox checkbox font-awesome