簡體   English   中英

無法為HTML / Node.js服務器加載CSS文件

[英]CSS File not loading for HTML/Node.js server

我正在制作一個稱為“蝦”的網址縮短器。 當前,這是我的Node.JS:

 const express = require('express'); const app = express(); app.get('/', (req, res) => { res.sendFile(__dirname + '/index.html') }); app.listen(3000, () => { console.log('server started'); });

而我的HTML:

 <!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="/style.css"> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Shrimp</title> </head> <body> <h1>Shrimp</h1> <p>URL Shortener</p> <br> <form action=""> <input type="text" id="url" placeholder="URL to shorten" required> <input type="text" id="key" placeholder="Key (Optional)"> <button type="submit">Submit</button> </form> </body> </html>

很簡單,但是CSS沒有加載! 有人可以幫忙嗎?

我正在制作一個稱為“蝦”的網址縮短器。 當前,這是我的Node.JS:

 const express = require('express'); const app = express(); app.get('/', (req, res) => { res.sendFile(__dirname + '/index.html') }); app.listen(3000, () => { console.log('server started'); });

而我的HTML:

 <!DOCTYPE html> <html lang="en"> <head> <link rel="stylesheet" href="/style.css"> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Shrimp</title> </head> <body> <h1>Shrimp</h1> <p>URL Shortener</p> <br> <form action=""> <input type="text" id="url" placeholder="URL to shorten" required> <input type="text" id="key" placeholder="Key (Optional)"> <button type="submit">Submit</button> </form> </body> </html>

很簡單,但是CSS沒有加載! 有人可以幫忙嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM