-1

I am working on a project. two pages of coded HTML with CSS.. so I have all the coding done and working but here is my issue.

when I created the second page of HTML I forgot to throw it into a "pages" folder before beginning. so now I am just about done but I know to be correct I should have any pages that are not index.html inside of a folder. so, I threw my pagetwo.html into the "pages" folder and now page two will no longer speak will its CSS. I tried to edit my link paths any everything but for some reason, I can't get them to talk. everything works perfectly if I take my page two out of that pages folder but I just wanted it to be correct

EDIT: I realized I'm dumb and had a CSS for both pages. I went ahead and made one CSS for both pages and relinked page two to speak with the CSS and it still doesn't work.. which is where I am currently stuck.

My link tag: <link rel="stylesheet" type="text/css" href="css/style.css">

Nisharg Shah
  • 16,638
  • 10
  • 62
  • 73

2 Answers2

2

Change your link tag from

<link rel="stylesheet" type="text/css" href="css/style.css">

to

<link rel="stylesheet" type="text/css" href="../css/style.css">

Nisharg Shah
  • 16,638
  • 10
  • 62
  • 73
1

Here is what you need. Look at the solution of this question

Basically what it means is you should go back in your src by one level and the go to relevent folder and then select your file. or in your case if your css is in same directory that contains pages folder you just need to move a directory up by using ../ in the href attribute of link tag

Example: href="../mycssfile.css" or href="../foldercontainingcss/mycssfile.css"

Ashish Kumar
  • 166
  • 8
  • I would like to add that in some IDE's, it automatically fills out the correct path. – 10 Rep Apr 22 '20 at 16:53
  • 1
    GOD BLESS UR SOUL thank you! I was moving up but not enough.. i needed to add just another "." wow lol thnk you! – Danielle Sciberras Apr 22 '20 at 16:57
  • @DanielleSciberras Glad i could help – Ashish Kumar Apr 22 '20 at 17:01
  • @Programmer that happens when you add the file maybe idk... but when you move your file nothing in the code changes. Tried on Netbeans IDE nothing change. Could you provide more details. I am not sure what do you mean! – Ashish Kumar Apr 22 '20 at 17:04
  • 1
    @DanielleSciberras If you like this answer or you got any help from this answer, don't forget to consider up-vote and check this answer as the best answer for you by clicking on the right arrow, thanks! – Nisharg Shah Apr 22 '20 at 17:09