html - Firefox 中的对象适合意外结果

标签 html css materialize

由于声誉限制,我无法发布图片。但是this是我要显示的图像的链接。

enter image description here

我正在使用 Materialize.css 的“卡片”组件.我有这张卡片,上面有一张图片,我已将 object-fit css3 属性应用于该图片。该属性在 Google Chrome 上运行良好,但是,在应该支持 object-fit 属性的 Firefox 上,图像并没有像我预期的那样出现。我已经尝试搜索可能的 css 前缀,解决方法,例如将它们重新包装在 div 中,但这些都不起作用。这是我的代码:

CSS:

.card-officer .card-image img {
    object-fit: cover; /* Do not scale the image */
    object-position: center; /* Center the image within the element */
    height: 300px;
}

HTML:

<div class="card card-officer hoverable">
    <div class="card-image waves-effect waves-block waves-light">
        <div>
            <img class="activator" src="profile.jpg">
        </div>
    </div>
    <div class="card-content">
        <span class="card-title activator grey-text text-darken-4">Patrick Joshua Sarmiento</span>
        <h6>Public Information Officer</h6>
    </div>
</div>

如何在火狐等浏览器上实现object-fit的效果?

最佳答案

在修改了 CSS 之后,我得到了以下内容:

Materialize.css 插件中 waves-effect 类的 will-change: opacity, transform 属性导致 object-fit以防止行为不当。为此,我为受影响的 div 重置了 will-change: auto 的值。

关于html - Firefox 中的对象适合意外结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32331574/

相关文章:

jquery - jquery 选项卡表单的全局按钮

html - CSS 用于第一行的左右对齐,换行右对齐

html - 如何在容器内的 div 中居中放置 div?

python - 在 Python 2.5 中解码未知 unicoding 编码的最佳方法

jquery - 用 PNG 替换 slider 拇指?

jquery - HTML 预览插件 Jquery?

javascript - 单击手机/平板电脑,将鼠标悬停在其他设备上(面向 future )

javascript - 使用 Materialize-CSS 与 React-toolbox 或 Material-UI react 元素

angularjs - 值未显示在选择按钮中

javascript - 简单的Javascript文本框验证错误