Why isn't my css being applied??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why isn't my css being applied???

I put both the html and the css files in the same page, the name of the css file is style.css, and then in the html file I put the link <link rel="stylesheet" href="style.css" >

16th May 2020, 11:03 PM
Gabriel Biacchi
Gabriel Biacchi - avatar
4 Answers
+ 3
If you can provide the code we could assist you much better ,if it's on sololearn platform then you don't need to do that ,if you are applying an external sheet they should be in same folder or provide the correct path
16th May 2020, 11:05 PM
Abhay
Abhay - avatar
+ 3
You may need to add the directory path relational operators in your href path depending on the operating system of the machine you're trying to run the html page on. Where; . = same directory and .. = up 1 directory So if the html file and the css file are in the same directory then you would use href="./style.css" if you had the css in a directory that is adjacent to the directory in which the html was in you would need to go up 1 directory and then into that folder like href="../CSS/style.css" if the css was in a sub directory of the html directory then you would use. href="./CSS/style.css"
16th May 2020, 11:31 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
you probably didn't put the <link rel... /> between the <head> tags of the html file, but can't quite tell from your details.... an example of your code would help a lot
16th May 2020, 11:09 PM
Sebastian Pacurar
Sebastian Pacurar - avatar
+ 2
Thanks guys! I was able to solve my problem, it was due to the name of the file, it an extra ".css" for some reason, thank you so much
17th May 2020, 9:52 PM
Gabriel Biacchi
Gabriel Biacchi - avatar