简体   繁体   English

CSS样式适用于Chrome,但不适用于Firefox

[英]CSS styling works on Chrome but not on Firefox

In this case, i'm using bootstrap and added my own class for custom styling. 在这种情况下,我使用了引导程序,并添加了自己的类以进行自定义样式。 my custom style works on Chrome but not in Mozilla.. here is the example: 我的自定义样式在Chrome上有效,但在Mozilla上不可用。以下是示例:

element: 元件:

<input class="form-control en-input-label" id="source" name="source" value="Personal Contact" aria-required="true" aria-invalid="false" readonly />

on Chrome, it looks like this: 在Chrome上,看起来像这样:

在此处输入图片说明

but on Firefox, the style doesn't really apply, and it looks like this: 但是在Firefox上,样式实际上并不适用,看起来像这样:

在此处输入图片说明

here is the css comparison from dev tools.. 这是来自开发工具的CSS比较。

Chrome: 铬:

在此处输入图片说明

but, Firefox can't read the en-input-label class and go with the default class instead. 但是,Firefox无法读取en-input-label类,而是使用默认类。

在此处输入图片说明

can anyone explain what happens? 谁能解释会发生什么? why chrome is able to read the en-input-label but Firefox can't ? 为什么chrome能够读取en-input-label但Firefox无法读取?

EDIT: 编辑:

Here are css for en-input-label 这是en-input-label CSS

.form-control.en-input-label, .form-control.en-input-label:read-only {
    border-left: none;
    border-top: none;
    border-right: none;
    border-color: #e6e6e6;
    padding: 0px;
    display: inline-table;
    height: 30px;
    line-height: 30px;
    box-shadow: none;
    -webkit-box-shadow: none;
    margin-bottom: 0px;
    background: transparent;
    font-size: 12px;
    color: #777;
    font-weight: 500;
}

any other css related to the elems is form-control from bootstrap: 与elems相关的任何其他CSS都是来自bootstrap的form-control

.form-control {
    display: block;
    width: 100%;
    height: 34px;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.42857143;
    color: #555;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 0;
    -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
    -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
    -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
     transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
}

原因是Firefox需要供应商前缀 ,因此:

.form-control.en-input-label:-moz-read-only {

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM