I recently launched a basic Node.js website but encountered an unusual issue. When trying to style the body using the default style.css stylesheet provided by Express, I found that it was not recognizing it. The only workaround was to add the class body
directly to the body tag and modify the CSS declaration to .body
. Why is the code below failing to work?
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>