css does not work in nodejs

Asked

Viewed 109 times

0

I’m trying to render a template ejs with Node but the css is not being applied, and I don’t think it’s a problem in the file path. Below is the css.

* {
padding:0;
margin:0;
vertical-align:baseline;
list-style:none;
border:0
}

.text h1{
color: red;
text-transform: uppercase;
}

inserir a descrição da imagem aqui

insert image description here

inserir a descrição da imagem aqui

  • Receives an error in the console?

  • Hello! I suggest you change your question to English since you are posting in this version of Stackoverflow.

  • There was no sign

1 answer

1


There is a difference between the directory structure you see on your server express for the directory structure sent to the client, which contains all the HTML information to render. The public folder is the base directory for this type of files, so in your index.ejs the href of the link must be css/style.css . Make that change and everything must be working.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.