调整窗口大小时如何防止div被剪切? [英] How to prevent div from getting cut of when resizing window?
问题描述
我在浏览器左侧有一个显示正常的 div,但是一旦我调整了窗口的宽度,它就会在左侧被切断.这很好,但浏览器没有提供向左滚动以查看 div 其余部分的选项.
I have a div on the left side of the browser that shows fine, but once I resize the window's width, it gets cut off on the left side. This is fine, but the browser doesn't provide an option to scroll left to see the rest of the div.
与我在页面右侧的 div 相反,如果我缩短窗口的宽度并且右侧的 div 在右侧被切断,浏览器总是至少让我向右滚动以查看div 的其余部分.
As opposed to a div I have on the right side of the page, where if I shorten the width of the window and that right div gets cut off on the right side, the browser always at least lets me scroll right to see the rest of the div.
我怎样才能让它在左侧也如此?我尝试添加左边距,但没有用.
How i can make it so on the left side as well? I tried adding a left margin but that didn't work.
推荐答案
你应该尝试添加
body{
overflow: auto;
}
这应该在某些东西消失时自动添加滚动条.
This should automatically add scrollbars when something goes out of view.
这篇关于调整窗口大小时如何防止div被剪切?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!