0

Im having trouble with linking a CSS file to my HTML file. I havent done anything with HTML/CSS in a while so my knowledge has rusted a bit over time and now I need some help. I know theres a little "trick" that makes you escape the current directory, its href="../directory" I believe but my CSS file is even more above Let me show you my Filestructure to get a better understanding of what I mean : Folder containing Project --> CSS File & webroot folder --> website folder
now, I need to access the CSS File that sits in the same directory as the Webroot folder containing the website that contains the HTML file I need to access the CSS file from. I dont want to type the absolute Path for that like /home/user/project/styles.css but I know theres a trick to just go an instance higher by doing ../ but I dont know how it really works and It doesnt seem to work with multiple layers, only with one. If someone has more experience than I do, im thankful for any help I can get.

Barkeeper
  • 41
  • 3
  • You are right but it's [duplicate](https://stackoverflow.com/questions/31216705/link-stylesheet-from-a-parent-folder) – SidPro Dec 22 '20 at 03:42

2 Answers2

1

Just found it out, just do the ../ multiple times for example you have a folder in a folder and want to get out of both do ../../ :)

Barkeeper
  • 41
  • 3
0

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

just wondering if I can help you, there is a couple of ways to linking the CSS file, usually, you have to check the directory path of the CSS file which means if the CSS displays in the different file path you gotta use the dot notation, i.e:

but if you didn't use the different file path, it just writes as usual (No dot notation) just directly into the css file