0

I have the following file structure in my project:

  • app
    • html
      • index.html
    • css
      • style.css

the issue is that linking my style.css by the following wont work:

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

because it is taking the path relative, so it thinks that the file is in app/html/css/style.css

and even if I give it the absolute path:

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

it just doesn't load the style.css

Thank you for your answers in advance.

Community
  • 1
  • 1

1 Answers1

1

Telling the system to look for href="css/style.css" points it to the (non-existing) folder: html/css/style.css as your working directory (from which you are trying to reference the stylesheet) is the 'html' folder.

To fix this, you need to first go to its parent directory by prepending ../. This points to the 'app' folder. From there you can go into the 'css' folder, resulting in:

href="../css/style.css"

Roel Strolenberg
  • 2,922
  • 1
  • 15
  • 29