Linking css file in html | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Linking css file in html

hello guys I'm new in designing web I have a serious problem I want to link my class in css file to my html code, and I do this, but it doesn't work😠 please write a true code for linking and classes 🙏🙏🙏🙏

29th Mar 2017, 9:21 PM
Beny Saberi
Beny Saberi - avatar
3 Answers
0
so try this, create html file called "index.html" and pit this into it: <!DOCTYPE = html> <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <p class="test">Text here</p> </body> </html> Than create css file named "style.css" and put it in same map where index.html is. Put this code in it: .test { color: white; background-color: black; } If still css don't work but html works try deleting your browser history and clearing browser cookies and cache. Just press ctrl+h in browser and delete history. than it should work. Because sometimes browser saves one and don't open css every time...
29th Mar 2017, 9:41 PM
Ivan Kerepčić
Ivan Kerepčić - avatar
+ 1
You mean this: <link rel="stylesheet" type="text/css" href="style.css"> then in html use class, like: <p class="test">Text</p> and in css file put code for editing, like: .test { color: blue; }
29th Mar 2017, 9:30 PM
Ivan Kerepčić
Ivan Kerepčić - avatar
+ 1
I did like this, exactly, in htmlpad but it doesn't work
29th Mar 2017, 9:36 PM
Beny Saberi
Beny Saberi - avatar