Home > Software design >  My HTML file doesn't find any other files and returns 404
My HTML file doesn't find any other files and returns 404

Time:09-30

HTML doesn't find .js, .png or any other file that lie in the same root directory and returns 404. I have tried formatting the link in html that refers to css every way possible, still no result.

HTML code:

<!DOCTYPE html>
<html lang="en">
<head>
  <link href="style.css" rel="stylesheet" type="text/css"/>
  <meta charset="UTF-8" />
  <title>Simple website for ASCII Art Generator</title>
</head>
<body>
    <h1>ASCII Art Generator</h1>
<div>
  <form method="POST" action="/">     
    <center>
      <textarea type="text" name="input" rows="4" cols="80" placeholder="Write text here"></textarea> />
      <br>
      <label for="banner">Font:</label>
        <select id="banner" name="banner">
            <option value="standard">Standard</option>
            <option value="shadow">Shadow</option>
            <option value="thinkertoy">Thinkertoy</option>
        </select> 
        <input type="submit" value="submit" /></input>    
    </center>
  </form>
</div>
<div>
  <center>
    <textarea class="output" readonly="" wrap="off" rows="20" cols="110">{{.Text}}</textarea>
  </center>
</div>
<div>
  <a href="result.txt" download>
    <img src="images/download-button.jpg" alt="Download Button">
  </a>
</div>
</body>
</html>

Directory:

-folder
   -server.go
   -form.html
   -style.css
   --images
       -download-button.jpg

In the Edge dev tools it shows a blank style.css

CodePudding user response:

Try adding ./ as prefix to image source. ie, <img src="./images/download-button.jpg" alt="Download Button">

CodePudding user response:

try adding "../" to img src it

  • Related