简体   繁体   中英

CSS link href path with '/' in ejs file

pic 1 : set up express.static for public folder

pic 2 : set up href="/app.css" in post.ejs

pic 3 : result

I tried using /app.css and app.css in post.ejs

the results are the same as the third picture

Does that mean after I set up

app.use(express.static("public"));

in app.js then the root path for static file will be /public ?

And therefore

absolute path /app.css and

relative path app.css

are the same?

thanks

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

As your setting, public is the root folder. You can call app.css by 2 ways, "app.css" and "/app.css". They both get the file app.css in current root folder -> I think they are same.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM