- 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
15 Answers
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;
}
+ 4
It sounds like the css might not be correctly linked. Could show us the code with which you linked the css?
+ 2
What exactly "didn't work"? What error do you get?
https://www.wikihow.com/Run-a-HTML-File-in-Visual-Studio-Code
+ 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>
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
0
Lisa
It just run on the normal html code it didn't add the css features
0
It didn't work christain
0
I have tried several codes
Inline, internal and external
0
I tried
<div .intro{color:; background-color:;}
<Style>
p{}
<style>
0
Yeah I tried link too
0
I just don't know what's wrong
0
I have tried this before
Let me do it again
0
Wow thanks alot it worked
0
Yes I did
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;
}