css:布局问题
我有一个 css 布局,其中我有一个单页网站,
问题是我不想要滚动条,所以我隐藏了溢出,它工作正常,但是当屏幕分辨率不同时,底部的内容被切断了。解决这个问题的任何方法
我的意思是,当内容适合第一页时,网站不应该有滚动条,但当没有足够的空间容纳内容时,应该出现滚动条
I have a css layout where in I have a single page website
the problem is I did not want the scrollbar so i did overflow hidden and the it worked fine but when there is different screen resolution, so content in the bottom is cut off is there any way to work around this
I mean the website should not have a scrollbar when the things fit on the first page but then when there is not enough room for the content the scrollbar should appear
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
overflow:auto;
来代替。我的建议是对您的主体(或主容器)使用固定宽度和最小高度
这样浏览器将在需要时添加自己的滚动条。您可以在这里阅读有关固定宽度的信息 http://webdesign.about.com/od/ css/ht/htcsscenterfix.htm
You can use
overflow:auto;
instead.My recommendation is to use fixed width and minimum height to your body (or main container)
that way the browser will add is own scrolls if needed. you can read about fixed width here http://webdesign.about.com/od/css/ht/htcsscenterfix.htm
您需要
overflow:auto;
而不是overflow:hidden;
。overflow:auto;
将在需要时返回滚动条,而在不需要时则不会返回。You want
overflow:auto;
notoverflow:hidden;
.overflow:auto;
will return a scrollbar when needed, and won't when it isn't.