简体   繁体   中英

Can't link my css file to html

Please help, i really cannot see what i am doing wrong. I have tried all permutations and still cannot link so have started to write css code in html. Not what i want to do. Been looking at it too long and hoping someone can see my error. Thnks

  <!DOCTYPE html>
  <html>
 <head>
  <meta charset="utf-8">
  <link href="css/style.css" type="text/css" rel="stylesheet">
      </head>

My file tree is my directory folder name of the project then a sub folder css, then the style.css

Try This:

<link href="../css/style.css" type="text/css" rel="stylesheet">

OR

<link href="/ProjectName/css/style.css" type="text/css" rel="stylesheet">

假设您的索引文件位于 css 文件正下方的根目录中,您需要编写“./css/style.css” - 您绝对没有指向正确的位置。

<link href="./css/style.css" type="text/css" rel="stylesheet">

If you want to link to your stylesheet and it is not working, navigate to your stylesheet (it should look like http://www.example.com/css/style.css ) and then copy the URL to your <link rel="stylesheet"> tag so it looks like this:

<link rel="stylesheet" type="text/css" href="http://www.example.com/css/style.css">

instead of this:

<link href="css/style.css" type="text/css" rel="stylesheet">

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM