关键词搜索

源码搜索 ×
×

Web前端笔记-footer始终固定在底部及高度缩小时不显示

发布2022-05-25浏览1505次

详情内容

方法步骤:

①使用css将footer设置到底部;

②使用css响应式当高度小于多少时,不显示。

对应的footer代码如下:

 

  1. <footer id="myFooter" class="text-white" id="myFooter">
  2. <ul class="nav justify-content-center mb-3">
  3. <li class="nav-item"><a href="#" class="nav-link px-2 text-white">新时代程序员群</a></li>
  4. <li class="nav-item"><a href="#" class="nav-link px-2 text-white">联系站长</a></li>
  5. <li class="nav-item"><a href="#" class="nav-link px-2 text-white">大屏展示站点</a></li>
  6. <li class="nav-item"><a href="#" class="nav-link px-2 text-white">CSDN IT1995</a></li>
  7. <li class="nav-item"><a href="#" class="nav-link px-2 text-white">About me</a></li>
  8. </ul>
  9. <p class="text-center text-white">Designed by IT1995</p>
  10. </footer>

css如下:

  1. #myFooter{
  2. position:absolute;
  3. bottom:0;
  4. width:100%;
  5. height:100px;
  6. background-color: transparent;
  7. }
  8. @media screen and (max-height: 768px){
  9. #myFooter{
  10. display: none;
  11. }
  12. }

这里其他的css都是使用的是bootstrap

如:

  1. .text-white {
  2. --bs-text-opacity: 1;
  3. color: rgba(var(--bs-white-rgb), var(--bs-text-opacity)) !important;
  4. }
  5. .nav {
  6. display: flex;
  7. flex-wrap: wrap;
  8. padding-left: 0;
  9. margin-bottom: 0;
  10. list-style: none;
  11. }
  12. .justify-content-center {
  13. justify-content: center !important;
  14. }
  15. .px-2 {
  16. padding-right: 0.5rem !important;
  17. padding-left: 0.5rem !important;
  18. }

相关技术文章

点击QQ咨询
开通会员
返回顶部
×
微信扫码支付
微信扫码支付
确定支付下载
请使用微信描二维码支付
×

提示信息

×

选择支付方式

  • 微信支付
  • 支付宝付款
确定支付下载