以下HTML、CSS代码,为什么会出现垂直滚动条

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>

        * {
            margin: 0px;
            padding: 0px;
        }

        html, body {
            display: inline-block;
            height: 100%;
        }

        .wrapper {
            width: 300px;
            height: 300px;
            background-color: indianred;
        }
    </style>
</head>
<body>
    <div class="wrapper"></div>
</body>
</html>
阅读 2.4k
2 个回答

https://stackoverflow.com/que... 可以看一下这里面回答的
在你源代码上加上 html, body { ; ; vertical-align: bottom;} 滚动条也会消失, 或者去掉display:inline-block; 默认是block 滚动条也会消失

你把` html, body {

        display: inline-block;
        height: 100%;
    }`
    display: inline-block; 去掉就好
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题