I want to add a background image with a laravel URL. I can do this by just including the web path itself but I would like to use Laravel URL.
Here is how I do it now in css:
.toggle.active {
background: url("{{ asset('assets/img/cancel.png')}}");
background-repeat: no-repeat;
background-size: 25px;
background-position: center;
}
but it doesn't work
My Answer:
url('/images/background.jpg');_
If you want to use a Laravel URL in your CSS file, you can use the `asset()` helper function provided by Laravel. Here's how you can do it:
_.toggle.active {_ background: url('{{ asset('images/background.jpg') }}');_
This will generate the full URL to the image using the `asset()` function, which will include the base URL of your Laravel application.
Rate this post
3 of 5 based on 4046 votesComments