skip to Main Content

enter image description hereThe background-url() function was used to apply the background screen to PurpleCloud.png. However, no matter what I do, the image is not applied. Where did we go wrong?

After learning about how to write a file path, I tried several methods, but there was no change. How should I write it?

2

Answers


  1. The correct syntax should be something like:

    background-image: url('assets/PurpleCloud.png');
    

    In your case, if you use background image on a div, make sure you also add width and height to that div, try inspecting using Chrome devTool it will show you the element and its css.

    Login or Signup to reply.
  2. Try background-image: url(‘/src/assets/PurpleCloud.png’);

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search