简体   繁体   中英

Stylesheet (CSS) is not loading in my Sails application

I've placed a style sheet style.css inside the /assets/styles -folder and embedded it via <link rel="stylesheet" href="style.css" type="text/css"> in my something.ejs file.

But the stylesheet is not loading. Has anyone an idea?

Use the following to give the correct location of style sheet:

<link rel="stylesheet" href="../../assets/styles/style.css" type="text/css">

The first .. will take it to views folder, the next .. will take it to parent folder Employees , now you can give the path to your stylesheet.

This is because the path must always be relative to current .ejs or some other current file's location in the directory.

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