全宽div移动 [英] Full-width div on mobile

查看:117
本文介绍了全宽div移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个蓝色的顶端在这里连结,这个上方所有宽度大小,这就是我想要的。所以如果你调整你的窗口或打开它的移动这个蓝色的div是把边距两边,twitter bootstrap响应是这样做。我的代码与这个答案完全一样,但是tb仍然会带来利润,这是我的代码:

I have this blue top link here and this top is taking all width size, and that's what I want. So if you resize your window or open it on mobile this blue div is putting margins both sides, twitter bootstrap responsive is doing that. My code is exactly like this answer but tb still putting margins, that's my code:

<!-- this div is inserting blue bg image and wrap all content -->
<div class="background-top"> 
    <div class="container">
        <div class="span6"></div>
        <div class="span6"></div>
    </div>
</div>


推荐答案

我会使用类似的媒体查询背景div作为它的Bootstrap,似乎添加了body填充。给它一个去:

I would use a similar media query to target the top background div as its Bootstrap that seems to be adding the body padding. Give this a go:

@media (max-width: 767px) {
  .background-top {
    margin-left: -20px;
    margin-right: -20px;
  }
}

这篇关于全宽div移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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