0

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 .

2
  • is your file css displayed in <head> tag? Commented Jul 22, 2020 at 8:55
  • @sergeykuznetsov yes Commented Jul 22, 2020 at 8:55

4 Answers 4

1

You should use it like:

 <link rel="stylesheet" type = "text/css" href="../CSS_FILES/style.css">
Sign up to request clarification or add additional context in comments.

Comments

1

The correct href is "../CSS_FILES/style.css"

Comments

1

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">

Comments

0

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">

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.