How can the background be blurred?
& lt; body & gt;
& lt; div & gt; & lt; / div & gt;
& lt; / body & gt;
Answer 1, authority 100%
If you apply blur
to body
, the entire content of the page will be blurred.
To avoid this, you can move the background
to a new div
with position: absolute
, and wrap the rest of the content in another div
with position: relative
and z-index
higher than the background block:
. content {
position: relative;
z-index: 2;
color: #fff;
}
.bg {
position: absolute;
z-index: 1;
left: -10px;
top: -10px;
right: -10px;
bottom: -10px;
filter: blur (5px);
background: url (http://files.all-free-download.com//downloadfiles/wallpapers/1920_1080/tropical_beach_paradise_5k_17484.jpg) no-repeat center;
background-size: cover;
}
& lt; body & gt;
& lt; div class = "bg" & gt; & lt; / div & gt;
& lt; div class = "content" & gt;
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
& lt; / div & gt;
& lt; / body & gt;
Answer 2
. selector {
filter: blur (3px);
}