html - css 优先级,firefox 中的大多数特定选择器错误或行高计算不起作用?

标签 html css firefox

CSS

.card {
    line-height: 50px;
    padding: 0 5px;
}

.card .multi-material
{
    line-height:25px;
}

HTML

<div class="card">
    <div class="row">
        //Other columns
        <div class="col-xs-4 text-center text-ellipsis">
            <span class="pull-left material-quantity multi-material">9x  </span>
        </div>
        //Other columns
    </div>
</div>

对于上述场景中的跨度,firebox 将行高设置为 50,即使最具体的选择器说 25。然而 Chrome 没问题,使用 25。

查看 firefox 检查器给出的内容: enter image description here

应该如何解决这个问题?

仅供引用:如果有任何帮助,CSS 将使用 LESS 生成。

最佳答案

您的选择器没有达到您想要达到的目的。在您当前的代码中,您尝试更改子项的行高。但是行高之前应用于父级 (.card) 而不是子级。

你需要更多类似的东西:

.card span {
    line-height: 50px; // need a unit measurement here, added px
    padding: 0 5px;
}

.card span.multi-material
{
    line-height:25px; // need a unit measurement here, added px
}

关于html - css 优先级,firefox 中的大多数特定选择器错误或行高计算不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32191665/

相关文章:

css - Selenium WD |尝试将 'If' 语句与逻辑 'or' 一起使用

css - 在 Firefox 中使用 CSS Reset 在表 td 之间创建黑线

html - 我不想要的顶部边距

html - 多线程http文件上传

javascript - 从屏幕外滑动一个 div,然后再打开 toggle

html - 如何在不从其他行中删除样式的情况下仅更改具有自定义类的一行的 css 属性?

css - CSS : is there a webkit alternative for -moz-crisp-edges? 图像缩放

python - “Unable to find a matching set of capabilities”,使用 Selenium 和 Python 以及 Windows 10 上的当前 Firefox

javascript - 如何在关闭阅读更多/关闭面板时停止音频播放器。

php - 如何在mpdf中设置表格的高度