【问题标题】:How do I blur something in HTML? [duplicate]如何模糊 HTML 中的内容? [复制]
【发布时间】:2020-08-20 01:40:06
【问题描述】:

我想让我的顶部导航透明 (opacity: 0.9) 并且我想让顶部导航背后的背景有点模糊(就像 Apple Inc 在这里所做的那样:)

如何模糊背景?

【问题讨论】:

标签: javascript html css


【解决方案1】:

你可以使用backdrop-filter:

.background {
  background: url(https://picsum.photos/640/240) center/cover;
  width: 600px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

h1 {
  background-color: rgba(255, 255, 255, 0.2);
  padding: 40px 80px;
  color: white;
  
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
<div class="background">
  <h1>Hello World</h1>
</div>

同时检查supportage

【讨论】:

  • 非常感谢!这行得通。当网站允许时,我会勾选答案:)(8 分钟)。非常感谢
  • 仅适用于 Blink(Webkit 也支持前缀后面)
猜你喜欢
  • 1970-01-01
  • 2013-08-15
  • 1970-01-01
  • 2011-08-26
  • 2013-06-27
  • 1970-01-01
  • 2019-07-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多