css - 如何在默认 MainLayout.razor 中添加页脚?
问题描述
在默认 Blazor 布局中添加页脚的正确 CSS 是什么?- 我尝试了一些方法但没有成功。我感谢您的帮助。
@inherits LayoutComponentBase
<div class="page">
<div class="sidebar">
<NavMenu />
</div>
<div class="main">
<div class="top-row px-4">
Anything
</div>
<div class="content px-4">
@Body
</div>
<!-- ** How to make it stay fixed in the bottom? -->
<footer>
Anything, @(DateTime.Today.Year)
</footer>
</div>
</div>
解决方案
app.css
...
html, body, #app {
height: 100vh
max-height: 100vh;
}
...
将此添加到MainLayout.razor.css
...
.main > footer {
height: 3rem;
max-height: 3rem;
}
.main > .content {
height: calc(100vh - 6.5rem);
max-height: calc(100vh - 6.5rem);
overflow-y: auto;
}
...
@media (min-width: 641px) {
...
.sidebar {
max-height: 100vh;
overflow-y: auto;
...
}
注意:6.5rem
incalc(100vh - 6.5rem)
是top-row
( 3.5rem
) +3rem
页脚的默认值的总和。
推荐阅读
- google-apps-script - 如何设置 App Script 函数以仅在其中包含“PASS”的电子邮件表行?
- python - 替换 tkinter.Text 插入方法
- gradle - Gradle 发布 jar 到 nexus repo
- javascript - 利用 !在 JSX 中的 Reactjs 组件中
- python - 在 Python 中返回哈希表中唯一的元素
- class - 使用一个类的属性,而不必每次都写下它的名字
- python - 我正在制作一个 Discord 机器人,但是当机器人使用 Rythm 命令时,什么也没有发生。有没有办法来解决这个问题?
- python - 如何在 Python Pandas 中对具有计数唯一值的多列进行分组
- python - 更新列值以反映具有两个不同大小数据框的其他列值
- swift5 - 向 CLLocationDistance 添加一些计算