html - 对齐 self : flex-end breaks on mobile zoom

标签 html css flexbox

我有一个由页眉、内容和页脚组成的标准布局:

-----------------
|    header     |
|----------------
|               |
|    content    |
|               |
|---------------|
|---------------|
|    footer     |
-----------------

在桌面上一切正常,但是如果我使用移动设备并放大页脚,它不再与页面末尾对齐:

---------------
|             |
|   content   |
|             |
|-------------|
|-------------|
|   footer    |
|-------------|
| empty space |
---------------

CSS:

body {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

#footer {
  align-self: flex-end;
}

最佳答案

考虑使用视口(viewport)高度单位。

在正文CSS中,包括:min-height: 100vh;

关于html - 对齐 self : flex-end breaks on mobile zoom,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56291579/

相关文章:

javascript - CSS 动画,点击时切换旋转

html - 无法让提交框显示在文本框下方

javascript - 扩展 Accordion 列表项以保留在 flex 列中

html - 在复选框旁边 float 一个 div

php - Bootstrap 导航栏无法与 php 一起使用

jquery - 在实现 css 中更改日期选择器的语言

html - 无法使用 selenium webdriver 选择表的行,因为 div 类正在动态变化

html - 请帮我在页面加载时按顺序临时更改菜单项的颜色

css - Bootstrap flex 方向 - 行和列 -

html - 建议需要修复 flex/bootstrap prob