Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
398 views
in Technique[技术] by (71.8m points)

javascript - Frosted glass look

Is there an alternative to backdrop-filter in CSS? To get this example working I have to enable chrome://flags/#enable-experimental-web-platform-features

body {
  background: url('http://verdewall.com/wp-content/uploads/2016/08/Background-Images-4H9.jpg') no-repeat center;
}

.glass {
  width: 100%;
  height: 500px;
  background: rgba(0,0,0,0.8);
  
  -webkit-backdrop-filter: contrast(4) blur(30px);
  backdrop-filter: contrast(4) blur(30px);
}
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Blur</title>
</head>
<body>
  <div class="glass">
  </div>
</body>
</html>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

A workaround is to use clip-path, filter and the same content twice then you will have the same result as backdrop-filter

.container {
  width: 200px;
  height: 200px;
  position: relative;
  padding:1px;
}
.container .glass, .container .filter {
  background: url('https://lorempixel.com/400/200/') center/cover;
  text-align:center;
  color:#fff;
  height:100%;
}

.filter {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: 0;
  filter: contrast(4) blur(3px);
  z-index: 2;
  clip-path: polygon(5% 15%, 82% 30%, 83% 71%, 17% 73%);
}
<div class="container">
  <div class="glass">
    <h1>A title</h1>
    <p>Some content Some content</p>
  </div>
  <div class="filter">
    <h1>A title</h1>
    <p>Some content Some content</p>
  </div>
</div>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...