Css File Not Linking To Html File When Website Uploaded Online
Solution 1:
check to see if your html file is in the same directory where the css file is.
if not then instead of linking your css file like this -
"stylesheet.css"
Link it like this -
"name_of_directory/stylesheet.css"
if your css file is in a directory and your html file is in other directory then link your css like this -
"../name_of_directory/stylesheet.css"
you could also link your css file like this:
Solution 2:
A few items to check: 1. Check that you actually uploaded the CSS. If you did, and the permissions are correct, is it named stylesheet.css, all lowercase? If it's on a non-Windows system it may care about casing. 2. Is the CSS in the same folder as the HTML? 3. Give us more information and we can help, such as the hosting type, whether the HTML file is in a subfolder, and so forth. If it's in a subfolder, your path to the CSS file is probably wrong.
Solution 3:
I had a similar problem recently.
My File on my computer was named "background.JPG" and I had linked it in my CSS dokument with "Background-image: Url(background.jpg)" which worked completely fine on my computer but not on 000webhosting.
As it turns out, I had to go into my file in 000webhosting "fileview" where I changed the link to "Background-image: Url(background.JPG)"
Yes... It can be that simple...
000webhosting is Case sensitive when you link things.
I hope this was helpful
Solution 4:
I came across the problem today and I found the solution. The reason is that the path in your html
file cannot be recognized by the online server.
For example, I use the Linux apache2 tool to host my website. The default website folder is /var/www/html/
Let's say you stored subpages in /var/www/html/error-404/404.html & /var/www/html/error-404/style.css. Obviously, the css
file and html
file is in the same folder. You probably wrote the path as href="sytle.css". However, the server would not find the css
path.
The correct path is href="/error-404/css/style.css". The path should start from the document root of your website (im my case: the root path is /var/www/html).
Solution 5:
try to change
href="stylesheet.css"
into
href=//Put the full path to css file
Post a Comment for "Css File Not Linking To Html File When Website Uploaded Online"