I am trying to get a blur effect in a box like this, but at the moment, the blur effect covers the whole page instead of only inside the box
Is it not a good idea to add a background image for blur effect by using :before
?
body {
background: url('https://images.unsplash.com/photo-1496737018672-b1a6be2e949c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1491&q=80');
background-position: 0 -200px;
background-size: cover;
}
#wrap {
width: 70%;
margin: 50px auto;
border: 1px solid #fff;
box-sizing: border-box;
overflow: hidden;
}
.box {
width: 90%;
height: 100%;
margin: 0 auto;
}
.content:before {
position: absolute;
display: block;
content: '';
top: 0;
left: 0;
z-index: -1;
width: 100%;
height: 100%;
z-index: -1;
background: url('https://images.unsplash.com/photo-1496737018672-b1a6be2e949c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1491&q=80');
background-position: 0 0;
background-size: cover;
filter: blur(10px);
}
p {
color: #fff;
text-align: justify;
}
<div id="wrap">
<div class="box">
<div class="content">
</div>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur vel eros justo. Proin in tincidunt mi. Vestibulum quis velit vestibulum lectus eleifend ultrices ut ac mi. Quisque sagittis faucibus diam, sit amet rhoncus nisi fermentum in. Suspendisse
faucibus interdum odio. Quisque iaculis accumsan sagittis. Integer id neque id turpis ornare ultricies at vel tellus.
</p>
</div>
</div>