【问题标题】:I made a layout, and sideband or sideline appears don't know why我做了一个布局,出现边带或边线不知道为什么
【发布时间】:2017-11-24 06:34:00
【问题描述】:

我做了一个新的布局,但有边带或边线(我的意思是滚动线“当内容太多时”,你必须滚动很多“但这条边线在谷歌浏览器的底部)出现在全视口不知道为什么会这样。如果我将换行宽度从 100vw 更改为 90,右侧会有空白,这是不好的。

图片如下:

这是我的代码:

<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.css">
<script src="https://code.jquery.com/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
 <div class="wrap">
  <div class="el2">header</div>
   <div class="el1">left</div>
   <div class="el3">
     <div class="el5">pakk1</div>
     <div class="el6">pakk1</div>
     phakk
   </div>
  <div class="el4">footer</div>
</div>

</body>
</html>



* {
  box-sizing: border-box;
}
.wrap {
  width: 100vw;
  height: 100vh;
  background: grey;



}

.el2 {
  width: 100vw;
  height: 30vh;
  background: #C2FF76;
}

.el1 {
   width: 20vw;
  height: 70vh;
  background: blue;
  float:left;
}
.el3 {
  float:left;
     width: 80vw;
  height: 70vh;
  background: red;
}
.el4 {

     width: 100vw;
  height: 13vh;
  background: purple;
  float:left;
}
.el5 {
  width: 30vw;
  height: 13vh;
  background: green;
  float:left;
}
.el6 {
    width: 40vw;
  height: 13vh;
  background: green;
  float:right;
}

【问题讨论】:

    标签: html css layout flexbox


    【解决方案1】:

    如果你在最顶层的容器上隐藏溢出,这个问题就会消失。

    .wrap {
      overflow: hidden;
    }
    

    最好弄清楚为什么会出现溢出,这样您就可以解决根本问题。

    https://css-tricks.com/findingfixing-unintended-body-overflow/

    注意:您也只能更改 X 和 Y 轴的溢出

    https://css-tricks.com/almanac/properties/o/overflow/

    【讨论】:

    • 但是乔纳森如果它隐藏了所有的边线我的意思是右边我不能向下滚动来检查底部的内容/页脚。我只想解散底部边线而不是右侧。这有什么可能吗?我要检查那个链接
    【解决方案2】:

    Bootstrap 在某些元素上使用负边距,这就是导致您的问题的原因。

    只需将所有 vw 值更改为 % 值(相同的数值) - 这些考虑了父元素的“实际宽度”。

    https://codepen.io/anon/pen/MopXrq

    【讨论】:

      【解决方案3】:

      实际上问题出在一些盒子的高度:vh 超出了限制。

      【讨论】:

        猜你喜欢
        • 2022-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-01-22
        • 2019-12-07
        • 2014-02-16
        • 1970-01-01
        • 1970-01-01
        • 2021-04-13
        相关资源
        最近更新 更多