How do i properly link my css and html file together, inspect element says "ERR_FILE_NOT_FOUND"

Titus

I've tried all the methods from HTML not loading CSS file but they don't seem to work. When I tried to inspect the element on chrome, they tell me

"Failed to load resource: net::ERR_FILE_NOT_FOUND" .

Here is my file structure

C>DevProject>index.html
and in my index.html there are two items one "index" which is my HTML folder, clicking it opens the website. And another item " style" which is my CSS file, clicking it opens notepad with the code

Here is the code

<!DOCTYPE html>
<html>
<head>

  <title>Test Title</title>
     <link href="/style.css/"type="text/css" rel="stylesheet">
</head>
<body>
    <h1>H1 text</h1>
    <p>I'm learning to code on Codecademy! My goals include:</p>
    <ul>
      <li>Goal 1</li>
      <li>Goal 2</li>
      <li>Goal 3</li>
    </ul>

</body>
</html>

Here is the CSS code

* {
    font-family: Helvetica, Arial, sans-serif;
  }


  h1 {
    color: SeaGreen;
  }


  p, 
  li {
    font-size: 18px;
  }


  a {
    text-decoration: none;
  }

I have also tried changing to href="DevProject/index.html/style.css/" but "Following the link" through VS code gives me the

Unable to read file 'c:\DevProject\index.html\DevProject\index.html\style.css\

I ensured that the encoding is UTF-8

I have also tried separating the CSS and HTML file like

Devproject>style.css>style

but same error

Jared Newnam

You've made a simple mistake, yet one that I've seen beginners make many times.

I'd recommend you start by removing the trailing slash at the end of your stylesheet reference.

If you have your stylesheet in the same directory as your index.html file, then do it as you see below. If you have your stylesheet inside of a css folder, then you can simply change it to <link rel="stylesheet" href="css/style.css">. Additionally, the type="text/css" isn't necessary.

<!DOCTYPE html>
<html>
<head>

  <title>Test Title</title>
     <link href="style.css" rel="stylesheet">
</head>
<body>
    <h1>H1 text</h1>
    <p>I'm learning to code on Codecademy! My goals include:</p>
    <ul>
      <li>Goal 1</li>
      <li>Goal 2</li>
      <li>Goal 3</li>
    </ul>

</body>
</html>

Hope this helps.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

HTML image net::ERR_FILE_NOT_FOUND

HTML, JavaScript and ERR_FILE_NOT_FOUND error

I built my Vuejs app by running npm run build, opening index.html throws errors: Failed to load resource: net::ERR_FILE_NOT_FOUND

Why are the files not found I get ERR_FILE_NOT_FOUND

How to catch Chrome error net::ERR_FILE_NOT_FOUND in XMLHttpRequest?

The webpage at file:///android_asset/file.html could not be loaded because: net::ERR_FILE_NOT_FOUND

net::ERR_FILE_NOT_FOUND file:///android_asset/www/index.html was not found

ReactJS - net::ERR_FILE_NOT_FOUND

ERR_FILE_NOT_FOUND after upgrade android version

Failed to load resource: net::ERR_FILE_NOT_FOUND but data is loaded

Electron + webpack + HMR net::ERR_FILE_NOT_FOUND

capacitor ionic 4 vue project net::ERR_FILE_NOT_FOUND

ionic dailymotion iframe player "ERR_FILE_NOT_FOUND"

console showing net::ERR_FILE_NOT_FOUND when trying innerHTML

javascript not loading image error::ERR_FILE_NOT_FOUND

AngularJS 2 and Cordova: "Failed to load resource: net::ERR_FILE_NOT_FOUND"

ionic 3 : Failed to load resource: net::ERR_FILE_NOT_FOUND logo.png

Suppress "Failed to load resource: net::ERR_FILE_NOT_FOUND" in Chrome Packaged App

Failed to load resource: net::ERR_FILE_NOT_FOUND loading json.js

Laravel dusk error on js submit failed to load resource: err_file_not_found

Cordova svg <image xlink:href/> throws Failed to load resource: net::ERR_FILE_NOT_FOUND [file:///android_asset/www/undefined]

Uploading chunked file using Ionic4 and Angular HttpClient fails after some successful uploads with net::ERR_FILE_NOT_FOUND

How do I link an html file with a CSS file if my HTML file is in a sub directory of a subdirectory and my CSS is in the styles folder?

How do I create a link in HTML and CSS which will populate a div or other element with an html file?

Angular Leaflet Directive yielding many GET file://c.tile.openstreetmap.org/17/38591/49266.png net::ERR_FILE_NOT_FOUND errors

How do I link my html button value with the variables i've created? right now it says logs it as an html object but not by its value

How to link CSS to HTML properly

How do I chain together package of (CSS/HTML). CSS/HTML -> CSS/HTML -> CSS/HTML

How do I change textbox size using css? And how do I connect my css file with my html file