Reputation: 27
I have a problem to get the right path from a pic inside a css-file (background-image)
The pic is inside
src / AppBundle / Resources / public / pics / blau.png
The css-file inside
src / AppBundle / Resources / public / css / default0.css
I have a in the index.html.twig (app / Resources / views / default) witch should get the background-image blau.png.
In the css I can format the div with border and size, no problem, but the backgound-image is not visible:
I've try the following syntax:
background-image: url("pics/blau.png") ;
background-image: url("../pics/blau.png") ;
background-image: url("../../pics/blau.png") ;
I can't find the Problem. THX
I installed assetic :
php app/console assets:install
and run
php app/console assetic:dump --env=dev
and what I also installed and config are Assetic
$ composer require symfony/assetic-bundle
Upvotes: 1
Views: 627
Reputation: 406
First put your images in the folder : (Manually or by assetic)
Web/uploads/public/pics
and in your css-file :
background-image: url({{ asset('uploads/public/pics/blau.gif') }});
Upvotes: 3