How do you link css to html? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How do you link css to html?

I tried to link it on my laptop but it didn't work even when I put them in the same folder

16th Sep 2018, 4:31 PM
Yaseen Abdallah
10 Answers
+ 7
<!--A simple example👇--> <!DOCTYPE html> <html> <head> <title>my web</title> </head> <body> <p id="error">my text</p> <!--css👇--> <style> #error{ font-size:40px; } </style> <!--css👆--> <!--js👇--> <script> alert("hello"); </script> <!--js👆--> </body> </html>
21st Sep 2018, 3:30 PM
Σιγμα
Σιγμα - avatar
+ 6
<link rel=“stylesheet” type=“text/css” src=“style.css”> replace style.css with your css file name.
16th Sep 2018, 4:40 PM
Dasun;
Dasun; - avatar
+ 3
Thank you but I tried it and it still isn't working. Do you know any other way?
16th Sep 2018, 4:47 PM
Yaseen Abdallah
+ 2
LOGA
21st Sep 2018, 1:49 PM
LOGA LOGA
LOGA LOGA - avatar
+ 1
Do I have to write the full location of the file.
16th Sep 2018, 4:50 PM
Yaseen Abdallah
0
if css file is in same directory with your html files no need to specify the location
16th Sep 2018, 4:51 PM
Dasun;
Dasun; - avatar
0
<link rel="stylesheet" href="style.css"> i dont know if that is any different than @Dasun; replace " style.css" with the css file name
16th Sep 2018, 4:52 PM
Farah Ahmed
Farah Ahmed - avatar
0
Thank you guys, but I am trying on notepad++ but it still isn't working
16th Sep 2018, 5:37 PM
Yaseen Abdallah
0
well if you dont mind, i would recommend Visual Studio Code (app) it works pretty well with me ‘still a beginner’, and codepen.io
16th Sep 2018, 6:35 PM
Farah Ahmed
Farah Ahmed - avatar
0
Of course I don't mind, thanks for your help and advice, I'm downloading it now.
16th Sep 2018, 6:51 PM
Yaseen Abdallah