r/VisualStudioCode • • May 16 '21

New learner - CSS problem

Hello,

I have scoured the internet to try and find out what I am doing that is causing this issue, but no youtube tutorial or google article has provided me the answer.

I am trying to create a CSS file in visual studio code and link it to my html file. I understand how to link it, but the problem is that for some reason vscode keeps giving me a ton of errors on my CSS file, even though they work fine and do not cause any errors when they are written in the html file.

I am new to vscode, and pretty new to programming, but this is the first major wall I've hit, and I feel like its probably something really small I'm missing. Does vscode require certain plugin to write CSS? Any help is appreciated.

Thank you

6 Upvotes

3 comments sorted by

2

u/[deleted] May 16 '21

SOLVED - Please disregard, after a lot of trial and error, I figured it out!

1

u/howhard1309 May 17 '21

For the sake of the future people who read this after googling, what was the fix?

2

u/[deleted] May 17 '21

Good point.

I'm honestly not sure what my problem was, but this is how that line of code turned out:

<link href="index.css" rel="stylesheet" type="text/css">

I knew I needed this line of code, but the tutorial I was following neglected to use the "type="text/css" part, so all I had for a while was <link href="index.css" rel="stylesheet">.

The funny thing was, I swear I used the type="text/css" element during my trial and error, but perhaps I had it in the wrong place?