Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

175
Views
HTML background image not showing up in my .Js file

My index.html file:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Weather</title>
</head>
    
<body style = "background: url(weather.jpeg); background-size: cover";>
    <h1>My weather application</h1>
    <form action="/" method="post"> 
        <input type="text" name="cityy" placeholder="Enter city name">
        <button type="submit" name="submit">Enter</button>
    </form>
</body>
</html>

My index.js file:

const express = require("express");
const https = require("https");
const bodyParser = require("body-parser")
    
const app = express();
    
app.use(bodyParser.urlencoded({extended: true}));
    
app.get("/", function (req, res) {
    res.sendFile(__dirname + "/index.html");
});

I am trying to make a simple Website using NodeJS, Express, HTML and JavaScript but for some reason the background I added in index.html is not showing up when I run my server (localhost:3000). I am using API to get the data. I don't seem to understand the problem. It's showing other elements like button and form but not the background. HTML background image not showing up in my .js file why? Is there any other way to do it? I don't seem to understand the problem. I also tried using <script src in html file.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!