按钮在Firefox中无法正常显示

时间:2018-05-29 15:52:26

标签: javascript html css cross-browser

所以我有了这个按钮,它在Chrome中看起来很不错,但在Firefox中加载它并且它完全不同。我尝试过添加前缀,但似乎没有任何改变。

$emails=imap_search($inbox,'TEXT "5b0b72417f673" ');
var checkbox = document.getElementById("cb4");
checkbox.indeterminate = true;
body
{
    font-family:arial;
}
.flipswitch
{
    position: relative;
    background: white;
    width: 120px;
    height: 40px;
    -webkit-appearance: initial;
    border-radius: 3px;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    outline:none;
    font-size: 14px;
    font-family: Trebuchet, Arial, sans-serif;
    font-weight: bold;
    cursor:pointer;
    border:1px solid #ddd;
}
.flipswitch:indeterminate:after
{
    position:absolute;
    top:5%;
    display:block; 
    line-height:32px;
    width:45%;
    height:90%;
    box-sizing:border-box;
    text-align:center;
    color:black;
    border:#888 1px solid;
    border-radius:3px;
}
.flipswitch:not(:indeterminate):after
{
    position:absolute;
    top:5%;
    display:block; 
    line-height:32px;
    width:45%;
    height:90%;
    box-sizing:border-box;
    text-align:center;
    transition: all 0.3s ease-in 0s; 
    color:black;
    border:#888 1px solid;
    border-radius:3px;
}
.flipswitch:indeterminate:after
{
  left:30%;
  content:"???";
  background:grey;
}
.flipswitch:not(:indeterminate):after
{
    left:2%;
    content: "OFF";
    background:#f00;
}
.flipswitch:not(:indeterminate):checked:after
{
    left:53%;
    content: "ON";  
    background:#0f0;
}

它意味着在Chrome中显示。

任何建议都会受到赞赏 - 如果我发现任何新内容,我会进行编辑。

干杯。

1 个答案:

答案 0 :(得分:2)

您只需要为Firefox添加-moz-appearance: initial;

var checkbox = document.getElementById("cb4");
checkbox.indeterminate = true;
body
{
    font-family:arial;
}
.flipswitch
{
    position: relative;
    background: white;
    width: 120px;
    height: 40px;
    -webkit-appearance: initial;
    -moz-appearance: initial;
    border-radius: 3px;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    outline:none;
    font-size: 14px;
    font-family: Trebuchet, Arial, sans-serif;
    font-weight: bold;
    cursor:pointer;
    border:1px solid #ddd;
}
.flipswitch:indeterminate:after
{
    position:absolute;
    top:5%;
    display:block; 
    line-height:32px;
    width:45%;
    height:90%;
    box-sizing:border-box;
    text-align:center;
    color:black;
    border:#888 1px solid;
    border-radius:3px;
}
.flipswitch:not(:indeterminate):after
{
    position:absolute;
    top:5%;
    display:block; 
    line-height:32px;
    width:45%;
    height:90%;
    box-sizing:border-box;
    text-align:center;
    transition: all 0.3s ease-in 0s; 
    color:black;
    border:#888 1px solid;
    border-radius:3px;
}
.flipswitch:indeterminate:after
{
  left:30%;
  content:"???";
  background:grey;
}
.flipswitch:not(:indeterminate):after
{
    left:2%;
    content: "OFF";
    background:#f00;
}
.flipswitch:not(:indeterminate):checked:after
{
    left:53%;
    content: "ON";  
    background:#0f0;
}
      
                   <!--Marketing Emails -->
        <div class="form-row">
              <h4>Do you wish to receive Marketing Emails</h4>
              <p>Emails reminding you to keep your account updated, and to continue your job search with redacted</p>
                 <div>
                    <input type="checkbox" id="cb4" class="flipswitch" name="marketing"/>
                     &nbsp;<span></span>
                 </div>
              
            
            
            </div>