skip to Main Content

I am using eclipse and I am trying to build a dynamic web project using html, css, javascript, and bootstrap. The problem is that I keep on getting error 404 whenever I try to link my style.css and script.js to my index.html. Here is my folder structure:

Web Content
  |-css (folder containing style.css)
  |-js (folder containing script.js)
  |-index.html (stored directly under webcontent)

I have tried using relative path as well as absolute path. But it is still not working. Here is the code in index.html:

<link rel="stylesheet" type="text/css" href="/css/style.css">
<script src="/js/script.js" type="text/javascript"></script>

I’ve used every possible combination but it still doesn’t recognize both files.

2

Answers


  1. <link rel="stylesheet" href="css/style.css" type="text/css" />
    <script src="js/script.js" type="text/javascript"></script>
    

    in your index.html file inside tag use above code, you have folder css with style.css file and folder js with script.js file. you can also click on your index.html file to open it in browser.

    Login or Signup to reply.
  2. use ./css
    instead for all paths

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search