Local background image not displaying in html

前端 未结 2 475
闹比i
闹比i 2021-01-28 01:38

I am trying to get background images working for html output from a system I develop for. I can output the page correctly, but the background images do not correctly display whe

相关标签:
2条回答
  • 2021-01-28 01:54

    Replace the slash '\' to '/'. URL's have to be in forward slash

    0 讨论(0)
  • 2021-01-28 02:08

    Like, I mentioned in my comment above, "\" or backslash is generally used for referring to the absolute path of a path and is a Windows standard for referring to the location of files. We make use of "/" or forward slashes as they are used to refer to the relative path with the current working file. So,

    ./ refers to the current working directory.

    ../ refers to the parent directory.

    ./images/ refers to a folder which is present in the same location as the working directory and likewise to access the files inside the folder, you put a forward slash to refer to it.

    As for, why it worked when you used the backslash path inside the img tag but not in the css, I'm not really sure of. But it's not a good practice and definitely not the proper way of doing things. Hope, it helps.

    0 讨论(0)
提交回复
热议问题