I have the following folder setup:
Main
css
stylesheet.css
sub
example
index.php
index.php
How do I link stylesheet.css
for the index.php
file in example
?
<link rel="stylesheet" type="text/css" href="css/stylesheet.css">
This only works for index.php
in the Main section.
In a DOS, Windows or Mac command line, two dots (..) refer to the preceding folder/directory level.
The href attribute A common situation is that the CSS file and the HTML file are in the same folder. In such a case you can write href="style. css" . If the CSS file and the HTML file are in different folders, you need to write the correct path that needs to go from the HTML file to the CSS file.
You can go two directories back like this: ../../
../
is used to fill the relative path structure.
<link rel="stylesheet" type="text/css" href="../../css/stylesheet.css">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With