the property: background-image: url("/image.jpg"); is not working online, only in my local browser. #59915
-
Select Topic AreaQuestion Feature AreaIssues Bodythe property: background-image: url("/image.jpg"); is not working online, only in my local browser. This is essential for the added value of my service as web developer and designer. It has appended in all my projects within Github. What can I do? Has any of it happened to anyone before? Guidelines |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 5 replies
-
|
Hi there Try providing the absolute path of the image. Note that url("/image.jpg") means that the image is in the top level folder of the web server and can be Also note that you can change background-image: url("/image.jpg") to background-image: url("image.jpg") |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for posting in the GitHub Community, @jjpicturesahora ! We're happy you're here. You are more likely to get a useful response if you are posting your question in the applicable category, the Issues category is solely related to conversations around the GitHub products Issues and Projects. We’ve moved your post to our new Programming Help 🧑💻 category, which is more appropriate for this type of discussion. Please review our guidelines about the Programming Help category for more information. |
Beta Was this translation helpful? Give feedback.
-
|
Which repo is it? Try adding ./ instead of /. Please look at this guide on relative pathing if this is the issue. Basically, ./ means start at the same directory as the file you are on (i.e. the file I'm trying to get is at the same level as the file I'm trying to get it in). ../ is saying to go one level back (I may be trying to get a file, but I'm in a folder, which is at the same level as the file). You can use multiple ../'s. Relative pathing is from the file you are on (or the page you are on if you are using relative pathing in JavaScript). Absolute paths start at the root, meaning they are relative to the very first level not the file you are on. Relative paths start with / just like you are doing. |
Beta Was this translation helpful? Give feedback.
-
|
you can move you're images into the public folder. after that you should be able to see them. |
Beta Was this translation helpful? Give feedback.
-
|
You can use "./" and "../" |
Beta Was this translation helpful? Give feedback.
I would honestly, always add ./ for same level just for caution.