简体   繁体   中英

CSS isn't linking to HTML

I'm not able to link my external CSS to my HTML. I have this code in the head of my index.html file:

    <head>
        <title>Twenty by HTML5 UP</title>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <link rel="stylesheet" href=".../assets/css/main.css" />
    </head>

My file directory looks like this:

  • /node-html

    • /views
      • /assets
        • /css
          • /main.css
      • /fonts
      • /js
      • /images
      • index.html
  • index.js

How can I fix this?

index.html is the same level as assets. Try this:

<link rel="stylesheet" href="assets/css/main.css" />

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