我想要在bg
中声明的图像适合container-fluid
,但它溢出。现场请参见https://www.soundshelter.net/。背景图像溢出格
我们的目标是让文字覆盖图像的顶部,因此可以将opacity
和blur
应用于图像,而不会影响文字。
我尝试过使用overflow:hidden;
,但这被忽略。
编辑:这也存在,如果我删除背景图像,并使用background-color
来代替。
<div class="container-fluid">
<div class="bg"></div>
<div class="row hero_header">
<h1>test</h1>
</div>
</div>
CSS
.bg /*this is the background image*/
{
position: absolute;
z-index: -1;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: url("/images/record_wall_orig_two.jpg") 0px 0px;
background-size:cover;
height:100vh;
background-color: black;
-webkit-filter: blur(8px);/Chrome, Safari, Opera/
filter: blur(8px);
}
你有没有尝试给bg类添加max-width和max-height属性? –
我已经@DhavalChheda,但它与移动网站的响应速度(使用Bootstrap) – Franco
这只需使用bootstrap jumbotron类即可轻松实现。那么你可以将jumbotron css背景设置为任何东西。 – claudios