0

Im really confusion, how to add a variables in css in background-image.

:root {
  --image-base-url: 'https://www.xxxx.com/';
}

.banner .img{
     background-image: url(var(--image-base-url + '/images/about.jpg'));

 }

Here is a error. It is possible to do this?

tomerpacific
  • 4,704
  • 13
  • 34
  • 52
anna
  • 859
  • 2
  • 9
  • 23
  • 1
    Does this answer your question? [CSS Variables with background-image url](https://stackoverflow.com/questions/41748998/css-variables-with-background-image-url) – tomerpacific May 13 '20 at 13:34
  • @tomerpacific that question isn't relevant to this one, not a duplicate – Temani Afif May 13 '20 at 13:39
  • You're trying to use JS-like concatenation in CSS. That's not currently possible. – chriskirknielsen May 13 '20 at 13:40
  • @tomerpacific it's not a duplicate question. I saw this you mentioned it. Im asking about concat two links using variables (first link) and another link(secon link). Please open this issue. – anna May 13 '20 at 13:44
  • you cannot do this, I added another relevant duplicate that explain whty – Temani Afif May 13 '20 at 13:55

0 Answers0