Reputation: 566
I am working on a front end project where my folder structure is :
FOLDER:BILL
FOLDER:CSS_FILES
file :style.css
FOLDER:HTML_FILES
file:index.html
FOLDER:IMAGES
image.png
This is how I load CSS in my html file and it does not work .
<link rel="stylesheet" type = "text/css" href="BILL/CSS_FILES/style.css">
I don't understand why as I have included the whole path . Maybe I should insert the css folder in the html one where it should work but I would like to know if there is another solution . Thank you in advance .
Upvotes: 0
Views: 272
Reputation: 3
There are two types of path. Absolute and relative. So for absolute path, it should start with main directory, where as in relative path,the directories are according to your present working directory. So the correct path is
<link rel="stylesheet" type = "text/css" href="../CSS_FILES/style.css">
Upvotes: 0
Reputation: 153
You should use it like:
<link rel="stylesheet" type = "text/css" href="../CSS_FILES/style.css">
Upvotes: 1
Reputation: 944474
You haven't included the whole path.
You've included a relative path.
Assuming the URL of the HTML document is http://example.com/HTML_FILES/index.html
then href="BILL/CSS_FILES/style.css"
will resolve to http://example.com/HTML_FILES/BILL/CSS_FILES/style.css
.
If you want to start from http://example.com/
then you need to use an absolute path which will start with a /
:
<link rel="stylesheet" type = "text/css" href="/BILL/CSS_FILES/style.css">
Upvotes: 1