Home > Software design >  CSS external sheet needs full path link instead of folder path. Why?
CSS external sheet needs full path link instead of folder path. Why?

Time:06-28

Picture of code

As with line 8 of my code, I should be able to link to the style sheet I need in a neighboring folder. But, that doesn't work and instead I need the full path.

In the online course I'm following, the instructor has it work that way except that they use css/styles.css I think because they're on a mac. I do css\styles.css because I'm on windows.

Also, even if I try going higher in the folders like doing Web Development\css\styles.css, that doesn't work either. It only works when I go all the way back to C: and so forth.

UPDATE: deleting <html lang="en" dir="ltr"> fixed it, but why?

Any tips?

CodePudding user response:

there is no css folder adjacent to the index.html file, you can use .. to go folder up and then go into the css folder and select the styles.css file.

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

CodePudding user response:

in your code, there is no such file path like your code try this one <link rel="stylesheet" href="/css/css.css">

  • Related