:元素在firefox中无法正常显示之前

时间:2014-12-05 23:22:44

标签: html css flexbox

为什么firefox错放了:before element ??

<div id='remember_forgot' class='no_hl'>
    <div>
        <input id='remember_me' type='checkbox'>
        <label for='remember_me'>Remember me</label>
    </div>
</div>

* {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.3;
    font-weight: normal;
}
input[type='checkbox'] {
    display: none;
}
#remember_forgot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2px 0;
}
#remember_forgot>div {
    position: relative;
    display: flex;
    align-items: center;
}

#remember_me+label:before {
    position: relative;
    top: 1px;
    content: "";
    display: block;
    float: left;  
    width: 13px;  
    height: 13px;  
    margin-right: 4px;

    font-size: 15px;
    line-height: 0.8;
    border: 1px solid black;
}
#remember_me:checked+label:before {
    content:'✓';
    color: black;
}
#remember_me+label {
    display: inline-block;
    margin-left: 0px;
    color: black;
    font-size: 13px;
}
#remember_me+label:hover {
    color: #e1b941;
}
#remember_me,
#remember_me+label,
#forgot {
    cursor: pointer;
}
#remember_me+label {
    transition: 0.2s all;
}

所有相关代码都在小提琴中:http://jsfiddle.net/kjf8h5m6/7/

当我在chrome中打开它时复选框:在元素正确居中之前: enter image description here

但是当在firefox中查看时,复选框看起来不是居中的: enter image description here

这很烦人..请帮帮忙!

1 个答案:

答案 0 :(得分:0)

enter image description here

(左边是chrome,右边是firefox)

删除通配符行高:*{line-height:1.3;},并在label元素中添加行高1.5,以解决Firefox和Chrome中的问题。

工作修正:http://jsfiddle.net/kjf8h5m6/9/