Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

178
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda