我目前有一个容器和一个内容。
如何将内容保留在浏览器中?
代码如下:
<h1>
Content inside
</h1>
最佳答案
通过简单地添加到 body
overflow: hidden;
并确保使用
box-sizing: border-box;
或删除 width:100%;
box-sizing:border-box; 修复了 100% 宽度填充的问题 - 将填充放在元素的框模型中。
*{margin:0;box-sizing:border-box;}
html,body{height:100%;font:14px/1.4 sans-serif;}
body{overflow:hidden;}
#container {
background-color: white;
min-height: 100%;
padding: 30px;
}
<div id="container">
<h1>
Content inside
</h1>
<div>
I currently have a container and a content inside. When the browser gets minimized, the content inside overflows, and the scroll bars appear. I currently have a container and a content inside. When the browser gets minimized, the content inside overflows, and the scroll bars appear. I currently have a container and a content inside. When the browser gets minimized, the content inside overflows, and the scroll bars appear. I currently have a container and a content inside. When the browser gets minimized, the content inside overflows, and the scroll bars appear. I currently have a container and a content inside. When the browser gets minimized, the content inside overflows, and the scroll bars appear. I currently have a container and a content inside. When the browser gets minimized, the content inside overflows, and the scroll bars appear. I currently have a container and a content inside. When the browser gets minimized, the content inside overflows, and the scroll bars appear. I currently have a container and a content inside. When the browser gets minimized, the content inside overflows, and the scroll bars appear. I currently have a container and a content inside. When the browser gets minimized, the content inside overflows, and the scroll bars appear. I currently have a container and a content inside. When the browser gets minimized, the content inside overflows, and the scroll bars appear. I currently have a container and a content inside. When the browser gets minimized, the content inside overflows, and the scroll bars appear. I currently have a container and a content inside. When the browser gets minimized, the content inside overflows, and the scroll bars appear. I currently have a container and a content inside. When the browser gets minimized, the content inside overflows, and the scroll bars appear. I currently have a container and a content inside. When the browser gets minimized, the content inside overflows, and the scroll bars appear.
</div>
</div>
关于html - 如何将内容保留在 View 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40328086/