HTML not loading CSS file

前端 未结 25 1322
执念已碎
执念已碎 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:30

    With HTML5 all you need is the rel, not even the type.

    <link href="custom.css" rel="stylesheet"></link>

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

    Use the following steps to load .CSS file its very simple.

    <link rel="stylesheet" href="path_here.css">

    note: 1--> don't forget to write "stylesheet" in rel attribute. 2--> use correct path e.g: D:\folder1\forlder2\folder3\file.css"

    Now where ever directory you are in, you can load your .css file exactly path you mention.

    Regards! Muhammad Majid.

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

    Here is another cause to add to the collection on this page. In this code...

    <link rel="stylesheet" type="text/css" href="styles/styles.css" media="screen">
    

    ...I misspelled rel as ref.

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

    I found myself out here looking for an answer and figured out that my issue was a missing character - spelling is important.

    <link href="tss_layout.css" rel=styleheet" />
    

    once I put the s in the middle of stylesheet - worked like a charm.

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

    Well I too had the exactly same question. And everything was okay with my CSS link. Why html was not loading the CSS file was due to its position (as in my case).

    Well I had my custom CSS defined in the wrong place and that is why the webpage was not accessing it. Then I started to test and place the CSS link to different place and voila it worked for me.

    I had read somewhere that we should place custom CSS right after Bootstrap CSS so I did but then it was not loading it. So I changed the position and it worked.

    Hope this helps.

    Thanks!

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

    i have the same probleme, i always change the "style.css" to "styles.css" or any other name and it worked fine for me.

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