首页 > 解决方案 > 自定义复选框在 Safari 上不起作用

问题描述

我的网站上有一个自定义复选框,选中后会显示一个fontawesome勾号。这在 Firefox 上完美运行,但在其他浏览器上,当我单击它时没有显示任何内容。在 Edge 上,它出现了一个灰色的小方块,但不是整个刻度。

请在下面找到我的自定义复选框的 CSS:

.newsletter input[type="checkbox"]:checked::after {
    content: "\f00c";
    color: #fff;
    position: absolute;
    left: 50%;
    top: 50%;
    -webkit-transform: translate(-50%,-50%);
    -moz-transform: translate(-50%,-50%);
    -ms-transform: translate(-50%,-50%);
    transform: translate(-50%,-50%);
}

.newsletter input[type="checkbox"] {
    padding: 7px 7px !important;
    height: 10px !important;
    width: 10px !important;
    display: inline-block !important;
    border: 1px #000 solid;
    background-color: #fff;
}

input[type="checkbox"] {
    padding: 2px;
    border: 4px solid #fff;
    border-radius: 100%;
    width: 20px;
    height: 20px;
    background-origin: content-box;
    box-shadow: 0 0 0 1px #999;
    -webkit-appearance: none;
    border-radius: 0;
}

input:checked {
    background-color: #3795f8;
}

input {
    -webkit-appearance: none;
    appearance: none;
    -webkit-border-radius: 0;
    border-radius: 0;
    border: 1px solid #ddd;
    padding: 10px 5px;
    font-size: 1em;
    display: block;
    width: 100%;
    margin-top: 5px;
}

input, select {
    vertical-align: middle;
    -webkit-border-radius: 0;
    border-radius: 0;
    padding: 0;
    margin: 0;
    margin-top: 0px;
}

有人可以建议我如何解决我的问题吗?

标签: htmlcsscheckboxcustom-controls

解决方案


推荐阅读