2

I have a .vue file where I want to use inline styles

<img src="~static/img/info/production/pic4.jpg" class="t22" />
<a href="/page/fresco-art" class="btn t23">First text</a>

<div class="hr t24"></div>
<h2 class="t25">Second text</h2>

<ul class="services">
  <li :style="{ backgroundImage: `url('~static/img/info/production/pic5.jpg')` }" class="sq">
    <div class="n">Third text</div>
  </li>
</ul>

The image using tag <img> is displayed correctly, but background-image in tag <li> is not.

How do I specify the file path correctly?

kissu
  • 40,416
  • 14
  • 65
  • 133
KAVA
  • 197
  • 1
  • 4
  • 16
  • Please try to use **my** syntax. – kissu Feb 26 '21 at 06:53
  • @kissu i tried it's doesn't help for me – KAVA Feb 26 '21 at 07:14
  • Want me to host it for you ?! I'm not sure why it does not help. Please elaborate on an error or why this is not helping. Totally working on my side... – kissu Feb 26 '21 at 08:26
  • @kissu i dont know why it doesnt work. I saw this solution many times before – KAVA Feb 26 '21 at 11:26
  • Okay, so I guess that you **really** needed a hosted solution for this one. I've just updated my answer, hoping this one can help since you do not provide me any error info. – kissu Feb 26 '21 at 14:05
  • Hi again, did my answer helped somehow at the end ? – kissu Mar 02 '21 at 10:39
  • @kissu Hi bro. I saw this answer three times before your comment. No it didn't work for me – KAVA Mar 03 '21 at 10:27
  • I created a codesandbox replicating a totally working example. If your code does not work, please do create one too, that way we will be able to inspect and find what is buggy here. We cannot find a solution if you do not provide an example nor any code/errors. – kissu Mar 03 '21 at 10:47