css - 用透明颜色和模糊叠加图像

标签 css image colors overlay

我有一个标题背景图片,它由 wordpress 加载到 html 中,如何用 RGBA/透明颜色覆盖它并通过 CSS 模糊其内容?

这是我的代码 https://jsfiddle.net/g0qhxjr9/

在这种情况下,您看到的 ing url 是 wordpress 特色图片功能

#header_img_over {
	height: 100%;
	overflow: hidden;
	background: rgba(28,28,34,0.9); 
  filter: blur(20px);
	z-index: 2;
}
.header_bg {
	z-index: -10;
	position: absolute;
	overflow: hidden;
	height: 245px;
	min-height: 245px;
	top: 0;
	left: 0;
	width: 100%;
}

.header_bg img{
    width: 100%; 
    margin: 0 auto;
    min-height: 300px;
}
<div id="header_img_over"><div class="header_bg"><img src="http://stylrs.com/v05/wp-content/uploads/2015/02/ML_Guildhall_TBL_0009-767x415.jpg"></div></div>

最佳答案

使用模糊滤镜:

.header_bg {
    filter: blur(20px);
    -webkit-filter: blur(20px);
}

Webkit 使用 -webkit-filter,过滤器应该适用于所有其他现代浏览器。

关于css - 用透明颜色和模糊叠加图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28533123/

相关文章:

html - 一个标签属性覆盖一个类属性

html - 为什么文本在html结构中包含在父元素中,但在浏览器中溢出了父元素?

html - Bootstrap 下拉菜单点击颜色

php - 如何使用 php 和 html 创建图像标题页

javascript - 当用户选择设置为无时选择的文本区域

javascript - 使用 Spring mvc 和 Angular JS 显示数据库中的图像列表

python - 使用 gitbash 终端将文件从 Windows 10 移动到 ubuntu 文件夹

javascript - 如何在 html 和 javascript 中同时切换文本和颜色?

与整数参数一起使用时,Java Color 创建会抛出 IllegalArgumentException

bash - 具有多种颜色的 Grep 输出?