HTML not loading CSS file

前端 未结 25 1327
执念已碎
执念已碎 2020-12-01 13:55

I am completely stumped as to why this doesn\'t work. It seems the HTML file can\'t load the CSS for some reason, even though both are in the same directory. Any idea what m

相关标签:
25条回答
  • 2020-12-01 14:50

    I was having similar problem but resolved changing the Style.css to style.css Because of this name caps letter "S"change it was throwing 404 error we won't notice small changes in my system it was working but when I hosted in cloud it was throwing this error make sure this all being checked after uploading in cloud

    0 讨论(0)
  • 2020-12-01 14:50

    After digging and digging on this issue, for me it was solved by Johannes on another thread: Local CSS file is not loading from HTML

    The type attribute in your link tag has typographical quote characters: type=“text/css”. Try to change these to "plain" quotes like type="text/css"

    0 讨论(0)
  • 2020-12-01 14:52

    Your css file should be defined as UTF-8. Put this in the first line of you css file.

    @charset "UTF-8";
    
    0 讨论(0)
  • 2020-12-01 14:55

    You have to add type="text/css" you can also specify href="./style.css" which the . specifies the current directory

    0 讨论(0)
  • 2020-12-01 14:55

    You could try this:

    <link href="style.css" rel="stylesheet" type="text/css" media="screen, projection"/>
    

    Make sure that the browser actually makes the request and doesn't return a 404.

    0 讨论(0)
  • 2020-12-01 14:56

    guys the best thing to try is to refreash the whole website by pressing ctrl + F5 on mac it is CMD + R

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