i just recently finish to code my first website and i want to host it. i succeed to upload it on webhost but i have a css problem. on the local it looks like that website in localhost
but on the website it looks like that website in hosting
we can clearly see that only a part of the css works the background image and the fonts is not working.
in the console network we can see that the link for the background-image link is not correct here is a picture of the error
so the link in the console is /assets/css/img/1364.webp but it should be /assets/img/1364.webp
So the first think I did, is to check the link in the css
here is a part of the css code
body {
background: url('../img/1364.webp') ;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
font-family: Arial, Helvetica, sans-serif;
}
We can see the url begins with "../" so normally it should go back from one folder so go into the assets folder where you can find several stuff like img folder. but it's not working at all.
this is how i organise the folder picture of the folder
i try a lot of things like : change the path change the background-image ... but always the same problem. I only talk about the background image but the font is the same error. because i'm a beginner i am completly lost and i hope it was clear to understand thanks
CodePudding user response:
Would it be possible to use absolute path for you? Using absolute path is a good habit to avoid such problem.
I saw you said the link becomes /PATH/OF/CSS//your/specified/link
then it might be the configuration of your hosting solution, alternatively you can use url like example.com/public_html/img/1364.webp
.