I've in laravel resource/sass/app.scss. In a such code:
.card {
..
background: url(/img/plus-green.png) no-repeat;
..
}
Is it possible to make an url according to website location e.g url(<?=url('/imgs/img.png')?>)
, that if website is in my localhost xampp http://localhost/myproj/public/imgs/img.png or in a live https://example.com/imgs/img.png . I'm looking for make dynamical urls to css.
CodePudding user response:
You should use relative paths instead of absolute paths.
Read more here on relative vs absolute paths.
You should change your code from:
.card {
..
background: url(/img/plus-green.png) no-repeat;
..
}
to
.card {
..
background: url(img/plus-green.png) no-repeat;
..
}