Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

176
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda