css - Firefox 和 IE 中的溢出 CSS 问题

标签 css internet-explorer firefox overflow

我正在处理包含许多页面信息的类。 这是类(class)的主要内容:

.class {     
    margin: 1% 0.5%;
    padding: 10px;
    border: 1px solid #E3E3E3;
    box-sizing: border-box;
    overflow: auto;
}

当我尝试在样式表 class="class class1"中添加一个使溢出属性无效的类时,它在 IE 和 Firefox 中不起作用。

.class .class1 {     
        margin: 1% 0.5%;
        padding: 10px;
        border: 1px solid #E3E3E3;
        box-sizing: border-box;
        overflow: auto;
    }

在 Chrome 和 Safari 中,溢出从级联中移除。 在 IE 和 Firefox 中,只有 .class 被拾取。

除了重新设计而忽略溢出之外,还有什么解决方法吗?

谢谢。

最佳答案

如果您的 HTML 是 class="class class1" 那么选择器是错误的。

这个

.class .class1 { /* with space */    
        margin: 1% 0.5%;
        padding: 10px;
        border: 1px solid #E3E3E3;
        box-sizing: border-box;
        overflow: auto;
    }

应该是这样

.class.class1 {    /* no space */  
        margin: 1% 0.5%;
        padding: 10px;
        border: 1px solid #E3E3E3;
        box-sizing: border-box;
        overflow: auto;
    }

原始声明之间的空格表明 class1class后代

我显示的第二个选项(没有空格)意味着该元素具有两个类并且仅适用于该实例。

关于css - Firefox 和 IE 中的溢出 CSS 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30942047/

相关文章:

css - 字体大小 <strong> 未正确缩放

javascript - 滚动到最近的 href 选项卡 jquery

javascript - CSS 如何在内部处理图像操作?

css - Chrome/FF 搜索结果突出显示样式

internet-explorer - IE11-避免窗口关闭确认消息

Angular 6 : ng test library with IE (Polyfills)

javascript - Firefox 扩展端口监听器

firefox - YouTube iframe 在 OSX Firefox 中未正确显示

html - 样式为“width=100%”的表格在 IE 和 Firefox 中导致不同的结果

html - Button 中的图像大小在 Internet Explorer 中格式不正确