带有模糊 Angular 的 html 图像标记

标签 html css

<分区>

我只是想为内联图像标签添加模糊 Angular ,但它不起作用。

我希望内联图像标签为我们设置 background 图像标签的样式,如下所示,如何实现?

.test {
  background: url(http://via.placeholder.com/350x150) left top no-repeat;
  box-shadow: 25px 25px 50px 0 white inset, -25px -25px 50px 0 white inset;
  width: 350px;
  height: 150px;
}

img {
  box-shadow: 25px 25px 50px 0 white inset, -25px -25px 50px 0 white inset;
  width: 350px;
  height: 150px;
}
<img src="http://via.placeholder.com/350x150" class="img-fluid" alt="Responsive image">

<div class="test"></div>

最佳答案

您可以使用一个技巧,创建一个容器并在您的图像上放置一个可以伪造模糊效果的层。

根据这个LINK我只是使用了 div 而不是 a


工作版本

.test {
  background: url(http://via.placeholder.com/350x150) left top no-repeat;
  box-shadow: 25px 25px 50px 0 white inset, -25px -25px 50px 0 white inset; 
  width: 350px;
  height: 150px;
}

.image-container {
  position: relative;
  float: left;
}
.image-container::before {
  position: absolute;
  content: '';
  top: 0; bottom: 0; left: 0; right: 0;
  box-shadow: 25px 25px 50px 0 white inset, -25px -25px 50px 0 white inset;
}
.image-container img {
  float: left;
}
<div class="image-container">
  <img src="http://via.placeholder.com/350x150" class="img-fluid" alt="Responsive image">
</div>
<br style="clear:both" />
<div class="test"></div>

关于带有模糊 Angular 的 html 图像标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49981165/

相关文章:

html - 为什么事件元素在 Firefox 中出现伪影?

PHPmailer 破坏 HTML 正文消息。 (漏洞?)

javascript - 使用 JQuery 将文本节点转换为 HTML 元素

CSS:应用于<td>和<tr>元素的css能否完美模拟<div>元素的样式?

php - 重新排序/重新包装 bbcode

html - CSS 画廊 IE 问题

javascript - 向下滑动时旋转图像

html - IE Z-Index/悬停问题

css - Bootstrap + 日期选择器

jquery - css 或 jquery 选择器排除子项