2 列:1 个 div 背景图像(在滚动被切断时),1 个内容高度:自动;

发布于 2024-11-28 18:52:07 字数 502 浏览 2 评论 0原文

我的头脑因我无法解决这个问题而闪闪发光。我希望有人能帮助我了解发生了什么。我阅读了很多帖子,尝试了很多,但似乎与我的问题略有不同。

成分:

  • 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 :(


Here are the sourcefiles

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

空城之時有危險 2024-12-05 18:52:07

您有两种选择,要么将菜单背景放在表格中,并赋予其 100% 的高度

,要么

将标题和内容 div 放在菜单 div 中,这样菜单 div 将始终与内容一样大。

        <div id="menu_container">
            <div id="menu"></div>
            <div id="header_container"></div>
            <div id="content"></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.

        <div id="menu_container">
            <div id="menu"></div>
            <div id="header_container"></div>
            <div id="content"></div>
        </div>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文