【发布时间】:2019-03-21 15:55:02
【问题描述】:
所以我的 application.html.erb 文件中有一个非常正常的设置:
<html class="h-100">
!head, title, scripts, stylesheets removed for this example here on stackoverflow!
<body class="d-flex flex-column h-100">
<!-- Dropdown Structure -->
<header>
<%= render 'shared/nav' %>
<div class="container">
<%= render partial: 'shared/message' %>
</div>
</header>
<main role="main" class="flex-shrink-0">
<%= yield %>
</main>
<footer class="footer mt-auto py-3">
<div class="container">
<h3>hello</h3>
</div>
</footer>
</body>
这对我来说看起来不错。但是,页脚是不可见的!事实上,当我访问一个页面时,它会完全消失。当我通过开发人员工具检查页脚时,它甚至没有在里面列出。
但是由于某些奇怪的原因,在某些页面上,页脚变得可见,然后也像通常应该的那样在开发人员工具中列出。
我最初的想法是一个旧的scaffold.scss 文件导致了这个问题,我完全删除了该文件,但是根本没有做任何更改。
我没有任何错误。以前从来没有遇到过这种问题。我已经在我的 app.scss 文件中搜索了任何 .footer 类、body、html 或任何其他可以从引导程序覆盖 css 的类,但找不到任何东西(在 vscode 中使用了搜索工具)。
编辑:
似乎我的 html 和正文的高度只有 760 像素,但是,主要是全宽(超过 2000 像素)。
我尝试添加 html, body { height: 100%; },但即使使用该高度,高度仍然只有 760 像素。这似乎是问题所在,因为显示页脚的页面不高于 760 像素。
有什么想法会导致这个问题吗?
【问题讨论】:
标签: html css ruby-on-rails bootstrap-4