The question is: Where is your html file? Obviously not in the root folder, but probably in another sub folder. Try this
<link rel="stylesheet" href="../css/style.css" />
This navigates one level up and then into the css folder.
I tried using bootstrap in my code for the first time and then after that my previous css work would not display. Now even though I’ve cut out the bootstrap and even tried making another simple bellow world page just to check , simple css like color won’t work. I’ve tried internal and inline Internal seems to be working for a complicated homepage but doesn’t for a simple hello world
EDIT- here’s my code And
This is it without bootstrap
I was following a youtube tutorial on how to make a website with html and css! The html part was going great and then I went and created a style.css file and wrote some code in it when I tried to update it so it syncs with the website it gave me a error called" Code language not supported or defined." my code is very simple infact here is the code I wrote
.nav-wrapper {display: flex;justify-content: space-between;}
I currently have no idea why this issue is here and I'd like to fix it since my style.css isn't syncing with my website.
Edit: Thanks for the help but the solution is: <link rel="stylesheet" type="text/css" href="styles.css" />
Videos
The question is: Where is your html file? Obviously not in the root folder, but probably in another sub folder. Try this
<link rel="stylesheet" href="../css/style.css" />
This navigates one level up and then into the css folder.
I would add the attribute type and value "text/css" Your link tag would end up like this:
<link rel="stylesheet" href="css/style.css" type="text/css"
Just started to learn code like 3 months ago and i don’t know why my vscode turn my CSS into Batch script automatically, it’s been 2 days i’ve searching the solution but i can’t currently work normally and i don’t care about Batch script, I have a project to complete in the next 4 months, save me.
vscode turn my CSS into Batch script automatically
That's... That's very very very extremely unlikely.
Show us your code. That should probably be the first thing you do when trying to get help with code.
It will help us help you if you show us how you know vscode turned CSS into a batch script. This evidence will be either code or a screenshot of something.
Are you talking about syntax highlighting? Lower right corner, in the status bar, you will see a label that states what syntax VS Code thinks your file is in. If this does not say "CSS", click on that label to change it to what you need. If it does, there is something else going on, and we can help you if you give us screenshots and/or code to look at.
If your filename ends with ".css", vscode should pick the CSS syntax highlighting automatically. Make sure it does this by closing the file's editor tab and reopening the file. If it does not, then the configuration has been changed, perhaps by an extension you installed, perhaps by butterfingers while clicking through some menu or dialog.
I don't believe jumping to css classes and ids is supported natively by Vscode. Try the CSS Peek extension, it does what you want nicely.
Make sure that the path you provided to access style.css file is correct. If that doesn't work, try adding inline css in index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test</title>
<style type="text/css" media="screen">
.abc{
width: 100px;
height: 100px;
background: red;
}
#xyz{
width: 100px;
height: 100px;
background: blue;
}
</style>
</head>
<body>
<div class="abc"></div>
<div id="xyz"></div>
</body>
</html>
This is an alternative Solution.
According to me your browser is not refreshing the file so you can refresh/reload the entire page by pressing CTRL + F5 in windows for mac CMD + R
Try it if still getting problem then you can test it by using firebug tool for firefox.
For IE8 and Google Chrome you can check it by pressing F12 your developer tool will pop-up and you can see the Html and css.
You can also try this syntax:
<link href="./css/style.css" rel="stylesheet" type="text/css" media="screen, projection"/>
Make sure that the browser actually makes the request and doesn't return a 404.
Hope It Helps!!
Whenever I open a html file in VS Code and open a preview using this extension, it opens a preview but doesn't show CSS or Javascript. It worked yesterday, so I don't know what the issue is.
I’m building a website on VS Code consisting of HTML and SCSS code. When I open the website on Google Chrome, using the Live Server extension for VS Code or from the file on my computer, it should show all the changes I made to HTML and SCSS. However, only HTML changes show up in the browser. Any changes made to SCSS don’t show up. This problem started about two weeks ago. Before then, all changes to SCSS were showing up without issue.
I’ve tried opening the project with Live Server and from my file on my computer, a hard refresh on Google Chrome, reinstalling the Live Server extension on VS Code, and updating VS Code. None of these steps solved the problem.
Any help would be greatly appreciated.
Hello everyone,
I downloaded VSCode for the first time two days ago and was pimped to get started on this awesome tool. But I have an issue: whenever I tie a CSS file or a JS file into the project, the browser does not recognise it and it is not run.
I have tried both FF (newest version) and Chrome (newest version), but the error persists.
As I am quite a raw beginner at web development (less than two months experience), I have also checked the code by rewriting it in Atom on my other machine and running it there. There it works.
Now I am wondering what I might be doing wrong. Can anybody help me with this issue?
Thanks in advance
GroundbreakingSpell
I had the same issue. So, I solved it by adding
"files.associations": {
"*.css": "css",
"css": "css"
}
to my my settings.json file. Don't know is it is going to help you, but anyway. Good luck!
When I'm using a basic style.css file, even after adding "postcss": "css" in "emmet.includeLanguages":{} CSS Intellisense still doesn't work.
Disabling the postcss VSCode extension allows CSS Intellisense to work properly for me.
(I am trying to build a multi-page website for shits and giggles)
This question probably has a very simple answer.
I started coding a few hours ago, I have figured out how to code ( very rudimentary ofc) HTML, and CSS... the two codes work fine together in a codepen... but I can not figure out how to get it to work in "Microsoft's visual studio code" (VSC)
I was learning on code pen but want to continue on a more substantial editor... furthermore, I have had luck, not perfect, implementing CSS code directly into the HTML, but I would rather have separate files so I can have a single CSS dictate the laws of style.
I was very excited (to show where I am at knowledge-wise) when I got my first HTML single text code to open up in a chrome tab.
SO when I run the HTML and CSS code in parallel with each other on Codepen... it works swimmingly... it only loads the HTML content and not my CSS code when on VSC
any help would be greatly appreciated
Anyone ever had Intellisense for CSS stop working? It was working fine last week and now it stopped. Its working fine with HTML & JS files but the auto-complete & class-predict for CSS is gone.
I have uninstalled/re-installed the extension and nothing. I've checked for VSCode updates and its all up-to-date. I have restarted everything, and nope.
Its annoying having to type it all by hand haha
Giving it a shot here as I've searched the entire web and have not been able to figure it out. Any insight is appreciated!
Hello, Im learning Bootstrap and using Visual Studio Code, for quite a while ive got a problem with my CSS files: They work when i create them, but after some time (or computer restart) when i make changes in them they don't apply them (changes) on site, to upload changes to site i need to create new CSS file but its name cannot be previous file, for example: I usually use main.css as my file name and when it stops working i create main2.css etc. when i try to delete old file and make new main.css it stilll does not want to work. Plz help
Your CSS declaration
h1 {
color: red;
}
may be directly in your .html file, but then it must be inside the <style> tag, which must be in turn inside the <head> tag:
<head>
<style>
h1 {color: red;}
</style>
</head>
so your full code will be
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
h1 {color:red;}
</style>
</head>
<body>
<h1>Hello</h1>
</body>
</html>
You Can try either applying inline css properties to your h1 tag like:
<body>
<h1 style="color:red;">Hello</h1>
</body>
Or you can put your code in tag like:
<head>
<style>
h1 {color: red;}
</style>
</head>
Or you can use an external css file and link it in your head section.
I am preparing to complete one of the HTML/CSS certification projects on Free Code Camp.
I was following along with a YouTube video where someone did it and copying it into Visual Studio Code for practice. When I tried to run it, I could only get the original HTML page without the CSS changes. Any idea why this might be occurring and how I can fix it?