【问题标题】:There is a white space on the side of the page and cant get rid of it页面侧面有一个空白,无法摆脱
【发布时间】:2015-09-04 05:56:48
【问题描述】:

所以在旋转木马的右侧有一个白色的缝隙,我想搭上它,但无法弄清楚。如果有人知道如何解决它,那将有很大帮助。我真的不知道出了什么问题,所以我做了一个 Jsfiddle 并在下面添加了 css 代码。感谢您的帮助。

Jsfiddle

html,
body {
height: 100%;
width: 100%;
margin: none;
padding: none;
}   


@media(min-width:767px) {
.navbar {
    padding: 20px 0;
    -webkit-transition: background .5s ease-in-out,padding .5s ease-in-      out;
    -moz-transition: background .5s ease-in-out,padding .5s ease-in-out;
    transition: background .5s ease-in-out,padding .5s ease-in-out;
}

.top-nav-collapse {
    padding: 0;
}
}

.carousel,
.item,
.active {
height: 100%;
}

.carousel-inner {
height: 100%;
}

.fill {
margin-right: -50px;
width: 100%;
height: 100%;
background-position: center;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}

.intro-section {
height: 100%;
padding-top: 150px;
text-align: center;
background: #fff;
}

【问题讨论】:

    标签: html css twitter-bootstrap carousel


    【解决方案1】:

    将行包装在容器内。不使用容器并直接使用一行将使其创建空白,因为它具有负边距。下面第 78 行:

    <div class="intro-section container-fluid">
      <div class="row">
    

    JSfiddle

    【讨论】:

      【解决方案2】:

      您需要从.row 类中删除边距

      从这里:

      .row{
      margin-right: -15px;
      margin-left: -15px; 
      }
      

      到这里:

      .row{
      margin-right: 0px;
      margin-left: 0px; 
      }
      

      请参阅JSfiddle 了解示例工作

      【讨论】:

        【解决方案3】:

        只需将Bootstrap的这段代码覆盖到0px即可:

        .row {
            margin-right: -15px;
            margin-left: -15px;
        }
        

        所以它看起来像这样:

        .row {
            margin-right: 0;
            margin-left: 0;
        }
        

        这会使滚动条消失。

        【讨论】:

          【解决方案4】:

          添加这个小 CSS:

          body{
              overflow-x: hidden;
          }
          

          小提琴:https://jsfiddle.net/lmgonzalves/zqrpg882/1/

          【讨论】:

          • 这将是一种大锤方法。
          • 有时是最好的选择 ;)
          猜你喜欢
          • 2021-12-18
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2018-03-19
          • 1970-01-01
          相关资源
          最近更新 更多