Lucas Cannon
Lucas Cannon

Reputation: 41

Link tag wont link html and css on node server

I pushed my project to git, and it was working just fine. However, now that I've cloned it onto a new computer, it's unable to link my html HTML my CSS stylesheet.

Here's the directory(?):

Project Directory

And here's the link throwing the error on the node server:

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

I'm sort of at a loss for what could be going wrong, especially after trying to link it with the path ../public/style.css

Any help appreciated!

Upvotes: 0

Views: 57

Answers (2)

Ryan Pereira
Ryan Pereira

Reputation: 105

Have you tried using the absolute path for testing? Let's try using this method.

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

If your server is making public folder not a part of dockroot, then that might be the case for the error.

Upvotes: 1

SathiyaNarayanan
SathiyaNarayanan

Reputation: 163

I can't get your problem. if the problem is in html file path 3rd option will help you. sorry if this isn't work.

  1. <link type="stylesheet" href="style.css"> - The "style.css" file is located in the same folder as the current page.
  2. <link type="stylesheet" href="public/style.css"> - The "style.css" file is located in the public folder in the current folder.
  3. <link type="stylesheet" href="/public/style.css"> - The "style.css" file is located in the public folder at the root of the current web.
  4. <link type="stylesheet" href="../style.css"> - The "style.css" file is located in the folder one level up from the current folder

Upvotes: 1

Related Questions