如果我添加以下css
html,body{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow-x: hidden;
}
这将解决空白问题,但它会删除水平滚动条,并且无论窗口大小如何,它都会应用 100% 宽度,但我的网站包含固定宽度。我可以在这里做什么?
最佳答案
使用 min-width
来实现您想要的。
例如,
html,body{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow-x: hidden;
min-width:xxpx; /* enter a pixel value more than 1px that distorts the layout on resize */
}
PS:xxpx是一个代表值。使用最适合解决问题的值。
关于html - 调整大小时如何在不删除水平滚动条的情况下删除空白?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20470381/