folder structure
/
|--index.php
+--includes
|--header.html
+--css
|--style.css
I have 2 subfolders in my main project folder. One is a folder called 'includes' and the other one is called 'css'.
I have my
-index.php
file in the main folder
-header.html
in my 'main/includes'
folder
-style.css
in my 'main/css'
folder
My index.php includes the header.html like this:include_once('includes/header.html');
(this Works!)
My header.html file links the css like this:<link href='../css/style.css' type='text/css' rel='stylesheet'/>
(this does NOT work!)
I don't understand why the css file is not loaded.
I have tried using the base tag, although I'm not sure I'm using it right.
<base href="http://localhost/main" />
(this is NOT working)
You should try using
<link href='css/style.css' type='text/css' rel='stylesheet'/>
As index.php
and the css
folder lie at the same level.
With
<link href='../css/style.css' type='text/css' rel='stylesheet'/>
,
you are asking your server to look after the style.css
in upper level directory of index.php
which does not exist.
You can also use /
because, it points do the document root of the website.
<link href="/css/style.css" type="text/css" rel="stylesheet" />
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