xhubobo

参考Bootstrap4官网例子Sticky footer,本文对其做了总结。

1、html标签

将html显示高度占满(class="h-100")。

<html lang="en" class="h-100">

2、body标签

设置body弹性布局,并将高度占满(class="d-flex flex-column h-100")。

<body class="d-flex flex-column h-100">

3、main标签

将main设置为不同的屏幕设备不设置收缩(role="main" class="flex-shrink-0")。

<main role="main" class="flex-shrink-0">

弹性收缩规则:

  • flex-shrink-0 不同的屏幕设备不设置收缩
  • flex-shrink-1 不同的屏幕设备设置收缩

4、footer标签

设置footer顶部边框高度自动设置(class="mt-auto")。

<footer class="footer mt-auto py-3">

分类:

技术点:

相关文章:

  • 2021-10-28
  • 2021-08-18
  • 2021-08-15
  • 2022-01-09
  • 2021-06-06
  • 2021-12-29
  • 2022-01-07
  • 2021-05-02
猜你喜欢
  • 2021-12-04
  • 2022-01-21
  • 2021-12-25
  • 2021-10-09
  • 2022-02-01
  • 2022-01-20
  • 2021-11-28
相关资源
相似解决方案