html - CSS - 如何使用 CSS 模糊图像的左侧和右侧

标签 html css

我正在尝试在整页图像的左侧和右侧创建模糊效果,但我不知道该怎么做。我想要实现的一个例子是here。 http://www.uchicago.edu/ .

我希望它们看起来像这样。

example image 1

example image 2

最佳答案

你可以这样做。试验左右的不透明度值和颜色。

.container {
  position: relative;
  display: inline-block;
}

.left, .right {
  position: absolute;
  width: 50px;
  top: 0;
  bottom: 0;
  background: white;
  opacity: 0.5;
}

.right {
  right: 0;
}
<div class="container">
  <div class="left"></div>
  <img src="http://placekitten.com.s3.amazonaws.com/homepage-samples/408/287.jpg" alt="" />
  <div class="right"></div>
</div>

关于html - CSS - 如何使用 CSS 模糊图像的左侧和右侧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45255744/

相关文章:

javascript - 获取段落对齐值

html - CSS:如何获得这种效果? (图片位于卡片上方,走出卡片)

javascript - Disable vs readonly 不适用于非交互式但值保持器输入

CSS:圆形图像

javascript - jQuery 添加类并为所有没有它的元素删除它

html - Angular 7+ : ngbDropdown menu collapse instead of popover

javascript - 我无法在 Jquery 循环插件中获取缩略图,只能获取文本数字

javascript - 在 RTL 模式下获取可滚动 DIV 视口(viewport)的更好方法?

html - CSS: 我的 "display:inline block"拒绝转换?

javascript - cssText 还是单独的样式名称?