Home > Net >  How to use background image?
How to use background image?

Time:09-03

I use Symfony framework. I want to add an backgroun image to my element with Tailwindcss framework.

I use this in index.html.twig :

<div ></div>

When run npm run watch and go to browser, it create <div ></div> but background.png not show and background-image: url(/images/background.png); was not created in css file.

How can I fix this problem?

CodePudding user response:

You can fix by adding a style tag.

<div  style="background-image:url('{{ asset('images/background.png') }}')"> </div>
  • Related