How can I use an image for the background of my page and add a blur affect without affecting the other content on the page or the sizing/positioning of the image itself? I did try researching the question, but I couldn't find any solutions that really helped me. I do apologize if this has already been asked/answered a lot though. Things I tried:
I added my background image to a body selector and added
filter: blur;
and-webkit-filter: blur;
(I got these off of a w3schools tutorial, I don't actually know if I need both of them), but this affected everything on the page, not just the background which I kind of assumed would happen anyways.I also tried doing the same thing by adding my background image to the body, but instead used
backdrop-filter: blur;
, and it sort of worked, but it didn't blur the edges of the screen, or any areas where content wasn't located. What I did:
body {
background: url("https://www.technobuffalo.com/sites/technobuffalo.com/files/styles/large/public/wp/2014/11/bloodborne-newhunter-03.jpg");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
backdrop-filter: blur(5px);
}
- Lastly, I tried creating a
<div>
tag and adding my background image to it, as well asfilter: blur;
and-webkit-filter: blur;
. Nothing showed up at first, but I learned it was because I was using an empty<div>
tag. I'm not actually sure what I am supposed to put in the div tag though, and I tried playing around with the padding and stuff, but I couldn't really figure out what to do. The background image just ended up all wonky, I couldn't figure out how to get it to cover the entire background of the page, and items also couldn't go on top of it like they would if it was just a part of the background. What I tried (I pretty much copied it off of w3schools, so I don't even know what all of it does):
<div class="bg-image"></div>
.bg-image {
background-image: url("https://www.technobuffalo.com/sites/technobuffalo.com/files/styles/large/public/wp/2014/11/bloodborne-newhunter-03.jpg");
filter: blur(8px);
-webkit-filter: blur(8px);
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
So what's the best way to simply add a background-image to my page and then blur it? I'm sorry if this has a really easy solution, I am new to coding still and am also just getting back from a break, so I am still really early in learning. This is also my first post on this site, so I apologize if I am doing this wrong.