Home > Net >  Why can't I link an external style sheet to a html file?
Why can't I link an external style sheet to a html file?

Time:10-19

Here's the following code and file alignment. Internal style sheets work well but I can't seem to link the same content in the external style sheet to this html file.

CodePudding user response:

Looks like you have incorrect path to your stylesheet. Try href="../css/mystyle.css"

CodePudding user response:

As the HTML files are in a folder themselves, that is where they start to look for externally linked files. If you fix the location of your CSS to ../css/mystyle.css, that should work.

In a path, the use of ../ at the start of your path tells the browser to look in the parent directory, which in this case brings it out of the HTML folder, and then back into the CSS folder.

  • Related