Beaquiche
Beaquiche

Reputation: 3

How to link a HTML page to a CSS file when the CSS file is in an upper directory?

There is my problem: Since I had some organization issues with my website, I wanted to arrange my files to a better classification.

Now, the folder tree looks like:

And now I don't know how to link the css file to the pages stored in a folder like the "mypage1" folder. To start from my C: drive will will produce path errors once online, I tried the "shortcuts to the css file in each folder" solution too, but I think there is a far better way to proceed. Need some help!

Thanks again!

Upvotes: 0

Views: 186

Answers (2)

user3561203
user3561203

Reputation: 29

use the link:

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

here, used ../ going back folder..

Upvotes: 1

Marin Atanasov
Marin Atanasov

Reputation: 3316

You can use:

<link rel="stylesheet" href="../ressources/css/design.css" type="text/css" media="all">

The .. will go one directory top. Since the html files are in a directory (like mypage1), this will go to the parent directory, which is www. Then the next that should be done is to pass the directory path to your CSS file, which in your case is /ressources/css/design.css.

Upvotes: 0

Related Questions