Alessandro Berrini
Alessandro Berrini

Reputation: 1

Why Live Server doesn't preview my CSS from Visual Studio?

When I "Go Live" with Live Server (extension in Visual Studio), it provides a preview of only my plain HTML file. On the other hand, if I open my HTML file by searching it in the folder where both HTML and CSS are, then the page loads normally with the CSS instructions.

Does Live Server only work for HTML or am I doing something wrong?

Upvotes: 0

Views: 1023

Answers (1)

Ahmed Hammad
Ahmed Hammad

Reputation: 3095

Usually this is because you’re using absolute path for linking your css, for example: C:\Desktop\website\styles.css

If so, you should use relative path instead: .\styles.css

As Live Server cannot see any path on your computer other than the folder it is hosting.

Upvotes: 0

Related Questions