Css not linking to html


#1

I am having similar problem where my index.css isn’t connecting to my index.html file they are both on different folders tho…


Css is not linking to html
#2

then the value for href attribute need changing, given this attribute is responsible for the location and filename of css file


#3

so i had two different folders, one called “Devprojects” and another folder called Resources inside of resources i had another folder called css with index.css
i got it to work but i had to put the resources file inside of devprojects in order for it to work … any ideas how to link both html and css file together if i separate both directories ?


#4

so you had this:

|- Documents?
   | - DevProjects
       | - index.html
   |- Resources
      |- css
         |- index.css

sure we can make a relative path link then as well:

href="..\Resources\css\index.css"
href="../Resources/css/index.css"

where .. is the parent directory, and the \ or / depends on OS used.

But Resource directories are often part of the projects, using the same resource directory over multiple projects is a bad idea


#5

yeah thats the structure i had it in, but now have resources in devprojects

so for different projects should get it’s own folder with resources ?


#6

absolutely, if resource folders are shared by projects you could get name conflicts and other problems which increase the risks at bugs.


#7

nice !! ok thank you so much really helped.:vulcan_salute: