在Bootstrap中使用Flexbox粘性页脚 [英] Using flexbox sticky footer with bootstrap

查看:39
本文介绍了在Bootstrap中使用Flexbox粘性页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用此粘性页脚:

I'm trying to use this sticky footer:

http://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/

body{
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.content{
  flex: 1;
}

但是它弄乱了<处的渲染.768px宽度.

But it messes up the rendering at the < 768px widths.

任何简单的CSS修复程序都可以使它适用于所有分辨率吗?

Any simple css fix to get it work for all resolutions?

http://jsfiddle.net/2xvv5mod/

推荐答案

您需要为flexbox项目提供 width 100%的宽度.

You need to give the flexbox item a width of 100%.

在这种情况下,就是那个 .content 元素:

In this case, that would be that .content element:

更新示例

body {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}
.content {
    flex: 1;
}
@media only screen and (max-width: 768px) {
    .content {
        width: 100%;
    }
}

这篇关于在Bootstrap中使用Flexbox粘性页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆