我在我的网站上模糊了一个容器的背景图像,它可以在所有浏览器上运行,除了iOS设备上的浏览器.

Css和html代码如下所示:

.backblurred {
    backdrop-filter: blur(20px);
    width: 100%;
}
<div class="jumbotron top-space">
        <div class="container backblurred">
            
            <h3 class="text-center thin">The Raw Facts:</h3>
            
            <div class="row">
                <div class="col-md-3 col-sm-6 highlight">
                    <div class="h-caption"><h4><i class="fa fa-tint fa-5"></i>Powered By Nature</h4></div>
                    <div class="h-body text-center">
                        <p>High quality acrilic paints, made for art enthusiasts, hobbyists and whoever else feels like painting.</p>
                    </div>
                </div>
                <div class="col-md-3 col-sm-6 highlight">
                    <div class="h-caption"><h4><i class="fa fa-leaf fa-5"></i>Eco-Friendly</h4></div>
                    <div class="h-body text-center">
                        <p>Our paints are made 100% form recycled materials, including: cigarette buts, wood, seaweed and coffee.</p>
                    </div>
                </div>
                <div class="col-md-3 col-sm-6 highlight">
                    <div class="h-caption"><h4><i class="fa fa-plus-square fa-5"></i>Safe To Use</h4></div>
                    <div class="h-body text-center">
                        <p>Our paints are 100% non-toxic and safe to use in any capacity that other profesional paints are used.</p>
                    </div>
                </div>
                <div class="col-md-3 col-sm-6 highlight">
                    <div class="h-caption"><h4><i class="fa fa-5a">A+</i>Premium Quality</h4></div>
                    <div class="h-body text-center">
                        <p>Our acrylic paints provide the same quality you can expect out of any other acrylic paint, while still being safe for the environment and fun for the every-day user.</p>
                    </div>
                </div>
            </div> <!-- /row  -->
        
        </div>
    </div>

我在网上研究了这个问题,但不明白我做错了什么.有谁能帮忙吗?

推荐答案

并非所有iOS设备和版本都完全支持Backdown-Filter css属性.

一种可能的解决方法是使用具有模糊背景的透明PNG图像作为容器的背景,而不是使用背景滤镜.这种方法可以达到类似的效果,并且在设备和浏览器中得到更广泛的支持.

下面是一个例子:

.backblurred {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.backblurred::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  
  /* replace background-image url with your image */

  /* note that if you use a local file as the image you should replace the url like: '/path/to/image'  */

  background-image: url(https://i.natgeofe.com/n/548467d8-c5f1-4551-9f58-6817a8d2c45e/NationalGeographic_2572187.jpg?w=1272&h=848);
  background-size: cover;
  background-position: center;
  filter: blur(20px);
  opacity: 0.8;
  z-index: -1;
}
<div class="backblurred">
  <h1>Hello, world!</h1>
  <p>This is some content that will appear over the blurred background.</p>
</div>

Html相关问答推荐

我需要两个HTML标签,以便当另一个隐藏时,一个可见,反之亦然

如何仅 Select 与子代CSS类匹配的第一个元素

带有多种 colored颜色 的HTML按钮

创建一个带有div和径向渐变的全宽半圆

让多对图像在各自的div中叠加

MatSnackBar: colored颜色 不起作用

有没有办法根据另一个项目调整FlexBox项目的大小?

如何影响flex项目中的flex-gap收缩顺序和文本换行顺序?

如何在小屏幕中制作水平滚动div

如何在没有包装元素的情况下在React(Next.js)中呈现HTML注释

如何使用 Tailwind CSS 分隔导航栏中的元素?

如何将 元素与常规文本垂直对齐

在HTML使用link标签导入外部CSS时出现元素link不允许使用尾斜杠错误

从 Vue 应用程序的容器元素渲染 HTML

视频添加到 Html 与 Github 不同步

a with