javascript - 如何使用 css 模糊图像 <img> 标签的一部分,我没有使用背景图像的选项

标签 javascript html css

我想使图像的某些部分模糊。

   li.slide:before {
     content: "";
     width: 25%;
     position: absolute;
     height: 100%;
     backdrop-filter: blur(25px);
     left: 0;
    }

    li.slide:after {
     content: "";
     width: 25%;
     position: absolute;
     height: 100%;
     backdrop-filter: blur(25px);
     right: 0;
    }

这段代码在 chrome 中使图像模糊,由于 firefox 不支持背景滤镜,我如何在 firefox 中实现相同的效果?

<div class="carousel carousel-slider">
    <button type="button" class="control-arrow control-prev control- 
    disabled" style="display: none;"></button>
    <div class="slider-wrapper axis-horizontal">
        <ul class="slider animated" style="transform: translate3d(0%, 
        0px, 
        0px); transition-duration: 350ms;">
            <li class="slide selected"><img src="../../slide1.jpg" /> . 
            </li>
            <li class="slide"><img src="../../slide2.jpg" /></li>
        </ul>
    </div>
    <button type="button" class="control-arrow control-next"></button>
</div>

Result expects

最佳答案

blur() CSS 函数对输入图像应用高斯模糊。它的结果是一个。

filter: blur(4px);

链接:https://developer.mozilla.org/en-US/docs/Web/CSS/filter-function/blur

关于javascript - 如何使用 css 模糊图像 <img> 标签的一部分,我没有使用背景图像的选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57453665/

相关文章:

javascript - 纯 javascript,onclick 不适用于移动设备

javascript - 如何在动态表中插入数组的某些值作为 <td> 的 CSS 样式属性?

php - 将文件值保留在<输入类型="file">中

css - last-of-type 不适用于 IE11 和 Edge 中的自定义元素

JavaScript 包装函数 - 未调用内部函数

javascript - Ant 设计表单initialValue如何使用

php - 精确匹配的 Strpos

html - 光标在 IE10 中超出文本输入范围

css - flexbox边距在 child 之间折叠

html - 使用 overflow-y 滚动 : hidden