Hello.
CSS in my project doesn’t work. In main file I have:
app.use(express.static(“public”));
And in ejs file I use:
What I am doing wrong?
Thank you in advance!
Hello.
CSS in my project doesn’t work. In main file I have:
app.use(express.static(“public”));
And in ejs file I use:
What I am doing wrong?
Thank you in advance!
Hi and welcome, @Karolina_Kot! Can you please describe your error better?
PS: Please use code blocks when formatting your code:
// code here (between the ``` chars)
Ok. I will try describe it better
My website based on NodeJS is working, but without CSS and Javascript.
In my main file I use:
app.use(express.static(“public”));
but it doesn’t work. I thought maybe is a problem with a path?
<link rel="stylesheet" href="./public/style.css">
In terminal I don’t have any errors.
When importing you should use:
<link rel="stylesheet" href="/style.css">
Instead of:
<link rel="stylesheet" href="./public/style.css">
Beware! Your ""
in the first code are “”
. It should be:
app.use(express.static("public"));
Instead of:
app.use(express.static(“public”));
Thank you! You are the best
Thanks!