1

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

1 Answer 1

3

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') }});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.