2 列:1 个 div 背景图像(在滚动被切断时),1 个内容高度:自动;
我的头脑因我无法解决这个问题而闪闪发光。我希望有人能帮助我了解发生了什么。我阅读了很多帖子,尝试了很多,但似乎与我的问题略有不同。
成分:
1 个主体,宽度 + 高度为 100%,背景上有图像图案。
左侧菜单有 2 个 div:(1 个用于背景图像,1 个用于图像顶部的菜单)
内容右侧 1 个 div。
现在,当我使用浏览器从屏幕底部到中间和后面等调整大小时,一切都很好。图像仍然显示它的全尺寸...但是当我使用滚动条向下滚动菜单中的背景图像时,它就被切断了。
我在所有相关对象中使用 height: 100% 和 min-height: 100% 。我只能想到一件事那就是使用 height: 1080px;但这仅当我的文本多于菜单背景的总长度时才有用:(
My mind is glowing of the fact I cannot fix this. I hope someone can help me understand whats happening. I read allot of posts, tried many but seems it's slightly different then my problem.
ingredients:
1 body with width + height on 100% and an image pattern on the bg.
2 divs for menu left: (1 for a background image and 1 for the menu it self op top of the image)
1 div right for the content.
Now, when I use the browser rezise from bottom to the middle and back etc of the screen it's all good. The image still shows it's full size... BUT the moment I use the scrollbar to scroll down the backgroundimage in the menu is beeing cut off.
I use height: 100% and min-height: 100% in all relative objects. I can only think of one thing and that is to use height: 1080px; but that only usefull when I have more text then the total lenght of the menu bg :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您有两种选择,要么将菜单背景放在表格中,并赋予其 100% 的高度
,要么
将标题和内容 div 放在菜单 div 中,这样菜单 div 将始终与内容一样大。
you have two choices either put the menu background in a table a give it a 100% height
or
put the header and content divs inside the menu div, this way the menu div will always be as big as it's content.