0

This is my path for my HTML file: C:\Users\Lorenzo\Desktop\Capstone Project\HTML\index.html

and this is my path for my CSS file: C:\Users\Lorenzo\Desktop\Capstone Project\CSS\style.css

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
lcarolus20
  • 29
  • 7
  • Are you running this HTML in a web server, or have you loaded it in your browser directly from your file system? – halfer Dec 28 '19 at 12:07
  • l loaded it directly from my file system. (I am using Visual Studio Code) – lcarolus20 Dec 28 '19 at 12:10
  • In the short term, hardwire the full path, so ``, and then set up a web server when you can. This will help you make it clear that `C:\Users\Lorenzo\Desktop\Capstone Project` is your project root and not `C:\Users\Lorenzo\Desktop\Capstone Project\HTML`. – halfer Dec 28 '19 at 12:13

2 Answers2

2

Add

<link rel="stylesheet" type="text/css" href="../CSS/style.css">
// or 
<link rel="stylesheet" type="text/css" href="..\\CSS\\style.css">

to your index.html file


Notice: If you're using Live Server on VSCode (like me). You have to open VSCode with the folder Capstone Project\, not HTML\, or you'll run into an error

Refused to apply style from 'http://localhost:3000/CSS/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

That error has been discussed here

Larry N
  • 261
  • 1
  • 9
0

link your CSS on head part of HTML file


<html>
<head>
  <title>Page Title</title>
   <!-- link your style.css file -->
  <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>

<!-- your HTML page body -->

</body>
</html>