代码之家  ›  专栏  ›  技术社区  ›  Searene

当我的总宽度是100vw时,为什么会有一个水平滚动条?[副本]

  •  -1
  • Searene  · 技术社区  · 6 年前

    这个问题已经有了答案:

    这是密码。我不知道为什么会有一个水平滚动条。

    <html>
    <head>
    </head>
    <body style="width: 100vw">
    <div style="float: left; width: 220px">a</div>
    <div style="float: left; width: calc(100vw - 220px)">b</div>
    </body>
    </html>
    1 回复  |  直到 6 年前
        1
  •  1
  •   Maharkus zok    6 年前

    margin

    body {
      margin: 0;
    }
    <html>
    
    <head>
    </head>
    
    <body style="width: 100vw">
      <div style="float: left; width: 220px">a</div>
      <div style="float: left; width: calc(100vw - 220px)">b</div>
    </body>
    
    </html>