I'm trying to render a template using:
res.render('template', data, function(err, html) {
...
});
In the template I have:
<link rel="stylesheet" type="text/css" href="/styles/style.css">
And it's not working (checking it with a red background).
The same markup works in pages that depend on views/layout.ejs, that is using:
<link rel="stylesheet" type="text/css" href="/styles/style.css">
How can I solve this (add style.css to the ejs file) ?
HTML
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<body>
...
</body>
</html>
链接标记只能放置在<head>
部分中 ,因此您可能必须将其放置在单独的布局中或禁用该布局,然后将带有包含样式链接标记的<head>
标记的整个HTML放置在视图中。
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.