html - 如何在没有背景图像的情况下使用 CSS 3 模糊部分下方的 div?

标签 html css

如何模糊该部分下方的 div,从而将该效果应用于该部分及其内容(想要获得没有背景图像的 OSX Yosemite 模糊效果)。

这是标记。

<!DOCTYPE html>
<html>
<head>
    <style type="text/css">

        section{
            display: table;
            position: relative;
            background: rgba(255,0,0,0.5);
            width: 300px;
            height: 100px;
        }

        section h1{
            display: table-cell;
            vertical-align: middle;
            text-align: center;
            color: #fff;
        }

        div{
            position: absolute;
            top: 30px;
            left: 10px;
            width: 300px;
            height: 100px;
            background: rgba(255,255,255,0.5);
            filter: blur(4px);
        }


    </style>
</head>
<body>


    <section>
        <h1>There is some content</h1>
    </section>

    <div></div>


</body>
</html>

最佳答案

我看到你有 filter: blur。我也用它做了一些测试,但无法让它在 firefox 31 中工作。似乎 text-shadow 应该完成类似的事情。

JSFiddle

.blurred {
   color: transparent;
   text-shadow: 0 0 5px rgba(0,0,0,0.5);
}

关于html - 如何在没有背景图像的情况下使用 CSS 3 模糊部分下方的 div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28932142/

相关文章:

javascript - 确认页面

html - 在伪元素在 chrome 和 firefox 上出现不同之前

html - 在 CSS 中倾斜多行

css - 使 div 留在父 div 内并留有边距

html - 如何在 bulma 列中设置全高背景颜色?

html - 删除所有 CSS 图像样式但保留 html 属性(宽度和高度)

html - HTML/CSS 中简单页面布局的问题

html - 歌词上方的响应和弦

html - 在 HTML 中,你会在行与行之间插入一个小空间吗?

css - 阻止重叠 float 但内容换行