页脚没有粘在底部 [Rails 7 Bootstrap]
Footer is not sticking to the bottom [Rails 7 Boostrap]
这是我的习惯
@import 'bootstrap/scss/bootstrap';
@import 'bootstrap-icons/font/bootstrap-icons';
footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: red;
color: white;
text-align: center;
}
我的页面就像
<body>
<%= render "layouts/navigations"%>
<div class="container">
<%= render "layouts/messages"%>
<%= yield %>
</div>
<%= render "layouts/footer"%>
</body>
<footer class="footer mt-auto py-3 bg-dark text-center">
<!-- Copyright -->
<div class="text-center p-3 mt-2 text-light" ">
© 2022 Copyright:
</div>
<!-- Copyright -->
</footer>
不确定为什么它不能与我的应用程序一起使用(但实际上以前在我的旧 rails 6 应用程序上工作。对于这个简单的问题真的很抱歉,因为我刚回来尝试再次学习网络应用程序并获得遇到这种问题。
在此示例中它运行良好。请提供工作示例,以便我们找出导致问题的原因。
footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: red;
color: white;
text-align: center;
}
.container {
background: #d9fbff;
height: 900px;
padding: 0;
}
<html>
<body>
<div class="container">
</div>
<footer class="footer mt-auto py-3 bg-dark text-center">
<div class="text-center p-3 mt-2 text-light">
© 2022 Copyright:
</div>
</footer>
</body>
</html>
这是我的习惯
@import 'bootstrap/scss/bootstrap';
@import 'bootstrap-icons/font/bootstrap-icons';
footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: red;
color: white;
text-align: center;
}
我的页面就像
<body>
<%= render "layouts/navigations"%>
<div class="container">
<%= render "layouts/messages"%>
<%= yield %>
</div>
<%= render "layouts/footer"%>
</body>
<footer class="footer mt-auto py-3 bg-dark text-center">
<!-- Copyright -->
<div class="text-center p-3 mt-2 text-light" ">
© 2022 Copyright:
</div>
<!-- Copyright -->
</footer>
不确定为什么它不能与我的应用程序一起使用(但实际上以前在我的旧 rails 6 应用程序上工作。对于这个简单的问题真的很抱歉,因为我刚回来尝试再次学习网络应用程序并获得遇到这种问题。
在此示例中它运行良好。请提供工作示例,以便我们找出导致问题的原因。
footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: red;
color: white;
text-align: center;
}
.container {
background: #d9fbff;
height: 900px;
padding: 0;
}
<html>
<body>
<div class="container">
</div>
<footer class="footer mt-auto py-3 bg-dark text-center">
<div class="text-center p-3 mt-2 text-light">
© 2022 Copyright:
</div>
</footer>
</body>
</html>