Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 在模糊的背景上清除文本_Html_Css - Fatal编程技术网

Html 在模糊的背景上清除文本

Html 在模糊的背景上清除文本,html,css,Html,Css,我使用CSS过滤器来创建一个模糊的背景,并在上面放置文本。但当我尝试时,文本上也出现了模糊效果。如何避免这种情况并保持文本不模糊 HTML } } 屏幕截图:不能在模糊的父元素中“取消模糊”元素。您可以使用一个绝对定位的伪元素来解决这个问题,该元素堆叠在您的标语后面: #intro { height: 500px; position: relative; } #intro:before { content: ""; background:url(../img/m

我使用CSS过滤器来创建一个模糊的背景,并在上面放置文本。但当我尝试时,文本上也出现了模糊效果。如何避免这种情况并保持文本不模糊

HTML

}

}

屏幕截图:

不能在模糊的父元素中“取消模糊”元素。您可以使用一个绝对定位的伪元素来解决这个问题,该元素堆叠在您的标语后面:

#intro {
    height: 500px;
    position: relative;
}

#intro:before {
    content: "";
    background:url(../img/meal.jpg) no-repeat;
    background-size: cover;
    width: 100%;
    height: 500px;
    position: absolute;
    z-index: -1;
    filter: blur(5px);
}

#tagline {
    text-align: center;
    font-family: 'Lobster', cursive;
    font-size: 4em;
    color: #fff;
}

它正在继承父母信息。您需要取消声明嵌套分区中的模糊。此问答()处理将透明度应用于背景并保持文本不透明。也许您可以修改它以将模糊应用于背景并保持文本清晰。
#intro{
background:url(../img/meal.jpg) no-repeat;
background-size: cover;
height: 500px;
 filter: blur(5px);
-webkit-filter: blur(5px);
-moz-filter: blur(5px);
-o-filter: blur(5px);
-ms-filter: blur(5px);
#tagline {
text-align: center;
font-family: 'Lobster', cursive;
position: relative;
font-size: 4em;
color: #fff;
#intro {
    height: 500px;
    position: relative;
}

#intro:before {
    content: "";
    background:url(../img/meal.jpg) no-repeat;
    background-size: cover;
    width: 100%;
    height: 500px;
    position: absolute;
    z-index: -1;
    filter: blur(5px);
}

#tagline {
    text-align: center;
    font-family: 'Lobster', cursive;
    font-size: 4em;
    color: #fff;
}