bootstrap div打破移动iphone

时间:2015-03-20 03:33:20

标签: css twitter-bootstrap mobile responsive-design

我有一个完全在桌面上工作的引导网站和(我认为)移动,因为当我将桌面浏览器的大小拖到超级瘦的时候,网站显示得很完美......但是在实际的移动设备上,它不是。顶部div(jumbotron)断裂,背景颜色向下流入下一部分。

有人可以看看并提出他们的意见吗?我充其量只是一个新手编码器,并且一直试图解决问题一段时间没有运气。

网站是www.artyst-tyrant.com

HTML:

<body>  

<div class="jumbotron" id="top">

<div class="video">
<video class="video-background visible-lg" no-controls autoplay loop src="img/dino-video.mp4?dl=0" poster="img/dino.png"></video></div>

<!--[if lt IE 9]>
<script>
document.createElement('video');
</script>
<![endif]-->

<div class="container content">
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>

<a class="navbar-brand" href="#">Artyst Tyrant</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="#intro" class="smoothScroll">Intro <span class="sr-only \">(current)</span></a></li>
<li><a href="#services" class="smoothScroll">Services</a></li>
<li><a href="#work" class="smoothScroll">Work</a></li>
<li><a href="#experience" class="smoothScroll">Experience</a></li>
<li><a href="#about" class="smoothScroll">About</a></li>
<li><a href="#contact" class="smoothScroll">Contact</a></li>
</ul>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>

<div class="row text-center text-container">
<h1>creating inspiring brands</h1>
<h2>to empower intelligent business</h2>
<h5>Isn’t it time the quality of your brand matched the quality of your business?</h5>

<a href="#contact" class="btn btn-primary btn-lg smoothScroll">Get Started Now</a>

</div></div>
</div>
<!--End Jumbotron-->

CSS:

/*logo */

.navbar-brand {
width:229px;
height:108px;
padding:0;
margin:0 0 0 60px;
background: url(../img/logo.png) no-repeat;
text-indent:-9999px;
z-index: 5; 

}


/*nav bar */

.navbar-default {
background:none;
border:none;
z-index: 5; 

}

.navbar-default .navbar-nav li a {
font-size: 16px;
font-weight:400;
text-transform:uppercase;
letter-spacing:2px;
color:#ecf0f1;
padding: 15px 0;
text-align:center;
z-index: 5; 

}

.navbar-default .navbar-nav li a:hover, .navbar-default .navbar-nav li a:focus {
color:#e5c6f1;
text-decoration:underline;
z-index: 5; 
-o-transition:.5s;
-ms-transition:.5s;
-moz-transition:.5s;
-webkit-transition:.5s;
transition:.5s;

}

.navbar-default .navbar-nav .active a, .navbar-default .navbar-nav .active a:hover, .navbar-default .navbar-nav .active a:focus {
background:none;
outline: 0;
color:#fff; 
font-weight:700;
z-index: 5; 

}

.navbar-toggle {
border:none;
margin-top:0;
margin-right:0;
width:32px;
height:32px;
text-align: center;
 z-index: 5; 

}

.navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus {    
background:none;
outline: none;
z-index: 5; 

}

.navbar-default .navbar-collapse {
border:none;
background: rgba(255,255,255,0.08);
border-radius: 2px;
box-shadow:none;
z-index: 5; 

}

/* end navigation */


/* end navigation */


.jumbotron {
background: url(../img/dino.png) no-repeat #8e44ad;
background-size:cover;
max-height:900px;
margin:0;
position:relative;
z-index: 2; 
background-attachment: fixed;
width: 100%;
overflow: hidden;
background-attachment: fixed;

}

.video-background { /* class name used in javascript too */
width: 100%; /* width needs to be set to 100% */
height: 100%; /* height needs to be set to 100% */
position: absolute;
left: 0;
top: 0;
z-index: -2;
}

video { display: block; 
opacity: .4; filter: alpha(opacity=40); -moz-opacity: .4;
filter:alpha(opacity=40); /* for IE only */
-khtml-opacity: 0.4;

}


.jumbotron:after {
background: url(../img/stripes.png) center repeat;
position: absolute;
top: 1;
left: 0;
right: 0;
bottom: 0;
height: 900px;
z-index: -1; 
content: '';
-webkit-transform: translate3d(0,0,0);
}

就像我说的那样,在桌面浏览器中将其拖动到移动宽度可以很好地显示移动设备,但是在iPhone上查看它并且顶部div会中断。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

我还缩小浏览器的大小以模拟它(黑客)作为移动设备。在您的情况下,宽度是关闭的。您应该设计至少320px(iphone标准宽度尺寸)。然后逐渐发展为更大的宽度和anomolies(andrioid和其他不同的大小)。

我在firefox中启动了你的网站,在320px我得到了一个滚动条。这个滚动条是一个问题。移动浏览器将扩展或抛出一些不一致的布局模式。

测试@ 320px。

编辑:

删除或调整任何<div class="row"></div>的大小。不要使用负边距。他们正在创建水平滚动条。