【发布时间】:2016-04-05 18:57:48
【问题描述】:
我刚刚启动并运行了一个基本的 Node.js 站点,但遇到了一些奇怪的问题。使用 Express 时默认提供的 style.css 样式表,我尝试设置正文的样式,但它似乎无法识别它。唯一的解决方案似乎是将body 类添加到实际主体并将css 声明更改为.body。为什么下面的代码不起作用?
style.css
body {
background-color: black;
margin-top: 50px;
}
.navbar {
height: 50px;
}
.footer {
text-align: center;
}
index.ejs
<!DOCTYPE html>
<html lang="en">
<head>
<% include partials/head %>
</head>
<body>
<% include partials/nav %>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12">
<h1><%= title %></h1>
</div>
</div>
</div>
<% include partials/footer %>
</body>
</html>
【问题讨论】:
-
您是否检查过元素以了解其获得的样式以及来自何处?
-
@Waxi 我相信这会解决它。似乎引导程序正在覆盖样式。
标签: html css node.js express mean-stack