I am trying to add a background image for my website in Laravel 9.51.
I’ve used this in my css file:
body {
background-image: url("background.jpg");
}
But it doesn’t work. Also tried:
body {
background-image: url({{asset('background.jpg')}});
}
but it doesn’t work either. Any ideas? My background picture is stored in public folder.
Btw,
I can access it from my browser on route:
http://127.0.0.1:8000/background.jpg
4
Answers
Actually what worked for me was:
background-image: url("/background.jpg");
(picture stored in public folder and I'm using Vite).Try with this one
You have to enter the photo with the address of the photo that is in the local