- 2

How to run css and HTML on visual studio code software

Even after saving both files in same folder and at their respective document names it still didn't work

31st Oct 2022, 1:12 PM
Momodu Abdulmalik
Momodu Abdulmalik - avatar
16 Respuestas
0
In your folder create 2 files. index.html styles.css Copy and save this into the index.html file. <head> <link rel="stylesheet" href="styles.css"> </head> <body> <p> Hello World <p> </body> In your styles.css file. p { color:red; }
1st Nov 2022, 3:44 AM
Chris Coder
Chris Coder - avatar
+ 4
It sounds like the css might not be correctly linked. Could show us the code with which you linked the css?
31st Oct 2022, 3:28 PM
Lisa
Lisa - avatar
+ 2
What exactly "didn't work"? What error do you get? https://www.wikihow.com/Run-a-HTML-File-in-Visual-Studio-Code
31st Oct 2022, 2:05 PM
Lisa
Lisa - avatar
+ 2
Have a look at Christian Daumal 's reply: add the css using <link> Then you can apply the styles using the class and id attributes, for example: <div class='intro'>Text</div>
31st Oct 2022, 3:50 PM
Lisa
Lisa - avatar
0
If both files are in the same folder, create the link:css in the head section. <link rel="stylesheet" href="./name_of_your_file.css" /> Click_right with the mouse; Select open with live server; Else download live-server-extention; BETTER : download the five-server extention => https://marketplace.visualstudio.com/items?itemName=yandeu.five-server
31st Oct 2022, 2:07 PM
Christian Daumal
Christian Daumal - avatar
0
Lisa It just run on the normal html code it didn't add the css features
31st Oct 2022, 3:09 PM
Momodu Abdulmalik
Momodu Abdulmalik - avatar
0
It didn't work christain
31st Oct 2022, 3:17 PM
Momodu Abdulmalik
Momodu Abdulmalik - avatar
0
I have tried several codes Inline, internal and external
31st Oct 2022, 3:42 PM
Momodu Abdulmalik
Momodu Abdulmalik - avatar
0
I tried <div .intro{color:; background-color:;} <Style> p{} <style>
31st Oct 2022, 3:44 PM
Momodu Abdulmalik
Momodu Abdulmalik - avatar
0
Yeah I tried link too
31st Oct 2022, 5:46 PM
Momodu Abdulmalik
Momodu Abdulmalik - avatar
0
I just don't know what's wrong
31st Oct 2022, 5:46 PM
Momodu Abdulmalik
Momodu Abdulmalik - avatar
0
I have tried this before Let me do it again
1st Nov 2022, 7:06 AM
Momodu Abdulmalik
Momodu Abdulmalik - avatar
0
Wow thanks alot it worked
1st Nov 2022, 7:24 AM
Momodu Abdulmalik
Momodu Abdulmalik - avatar
0
Yes I did
1st Nov 2022, 1:07 PM
Momodu Abdulmalik
Momodu Abdulmalik - avatar
0
I followed that process Chris coder said In your folder create 2 files. index.html styles.css Copy and save this into the index.html file. <head> <link rel="stylesheet" href="styles.css"> </head> <body> <p> Hello World <p> </body> In your styles.css file. p { color:red; }
1st Nov 2022, 1:09 PM
Momodu Abdulmalik
Momodu Abdulmalik - avatar