无法弄清楚为什么会有溢出

时间:2015-09-11 23:06:34

标签: css overflow

所有

我想我可能会误解某些CSS属性,但是有人可以帮我解释为什么会出现滚动条吗?

  <body ng-controller="main as main">
    <div class="app-container">
      <div class="chat-hist">
        <span>Why there is a scrollbar on the right?</span>
      </div>
      <div class="chat-input">
        <input class="chat-content" />
        <a href="#" class="chat-send">
          GO
        </a>
      </div>
    </div>
  </body>

,风格是:

<script>    
html, body {
        margin:0px; 
        padding:0px;
        width: 100%;
        height: 100%;
    }


    .ng-cloak {
        display: none;
    }
    .app-container {
        width: 100%;
        height: 100%;
        display: flex;
        flex-flow: column nowrap;
        margin:0px;
        padding:0px;
    }
    .chat-hist {
        width: 100%;
        flex:1;
    }
    .chat-input {
        width: 100%;
        display: flex;
        flex-flow: row nowrap;
        flex: 0 0 30px;
        margin:0px;
        padding:0px;
    }
    .chat-content {
        flex: 1;
        font-size: 16px;
        line-height: 30px;
        padding-left:10px;

    }
    .chat-send {    
        flex: 0 0 150px;
        font-size: 16px;
        display: inline-block;
        width: 100px;
        height: 30px;
        color: black;
        background-color: lightblue;
        text-decoration: none;
        text-align: center;
        line-height: 30px;
    }
    .chat-send:hover {
        background-color: pink;
    }
    .chat-send:active {
        background-color: lightgreen;
    }

</script>

我把代码笔放在No reason for scrollbar overflow

1 个答案:

答案 0 :(得分:0)

试试这个:

   html, body {
        margin:0px; 
        padding:0px;
        width: 100%;
      overflow:hidden;
        height: 100%;
    }