So i have a folder titled "Project 1" in desktop, inside this folder there are 2 other folders one titled "HTML" which has my HTML file in it and another folder titled "CSS" which has my CSS file in it. What would be the path name to linking the HTML file to css??
CodePudding user response:
reh!
If this is your folder structure:
Project 1
|-- HTML
| | index.html
|
|-- CSS
| | style.css
then in the index.html
you would need to link it as follows:
<link href='../CSS/style.css' rel='stylesheet' />
This is the relative path, so from index.html
you are going one level up (../
), enter the CSS folder (CSS/
), and pick the file (here style.css
).
CodePudding user response:
Project 1
-- HTML
-- index.html
-- CSS
-- style.css
index.html file : you are linking a css file in index.html that means right now we are in the html folder.
When we write ../
that means we are going one step back from the current directory; it means now we are in project 1 folder. and we write CSS/
it means we are going inside the css folder. and in last we mention style.css
it is our css file name.
<link rel="stylesheet" href="../CSS/style.css">