【发布时间】:2015-09-09 12:50:03
【问题描述】:
我使用 bootstrap 制作了一个模板,并且我正在使用 flexbox 将我的登录页面内容垂直和水平居中。它在桌面上看起来很好(chrome 和 firefox 检查),但在移动设备上(chrome 和 safari 检查)它浮动到顶部。我在网上搜索过,但没有找到适合我的解决方案。
我已经粘贴了我的代码,实时版本在http://webcanvases.com/download-theme/theme/material-theme.html
HTML
<!-- Landing Page -->
<div class="video-bg vertical-center" id="page-top" data-vide-bg="mp4/traffic2">
<div class="jumbotron container text-center">
<h1>Material World<br>Theme</h1>
<a data-scroll href="#about"><span class="glyphicon glyphicon-menu-down animated bounce"></span></a>
</div>
</div>
<!-- Landing Page End -->
CSS
.vertical-center {
display: flex;
justify-content: center;
align-items: center;
}
.video-bg {
height: 800px;
min-width: 100%;
}
【问题讨论】:
-
在您的手机中使用浏览器版本编辑帖子。
-
可能是浏览器不支持
flex的原因 -
.video-bgheight 设置为静态值 (800px)。尝试使用height : 100vh -
Blaze-我尝试切换到 100vh 但仍然遇到同样的问题。
-
Shehary- Chrome 支持 flexbox,但我尝试在我的 flexbox 属性前面加上 -webkit- 只是想看看它是否有帮助,但它没有。
标签: html css twitter-bootstrap