扩展容器div中的div以适应不同的分辨率

发布于 2024-12-27 13:38:21 字数 301 浏览 2 评论 0原文

我有一个 HTML / CSS 问题,关于在填充其他 div 时如何增长一个 div 以适应屏幕。

这是我的“主”div 内的结构:

我在容器 div 内有 3 个 div,容器内的最后一个 div 具有溢出:auto;属性(因为它具有可滚动内容)。整个容器div向左浮动。

如何让最后一个内部 div 随着屏幕分辨率而扩展?这里的问题似乎是我的容器 div 没有真正的“大小”,所以当我将其设置为 height: 100%;真的没有发生任何事情。当然,这意味着如果我为其分配实际大小,那么它不会增长到分辨率。

我该怎么办?

I've got a HTML / CSS question about growing a div to fit the screen when filled with other divs.

Here's my structure which is inside my "main" div:

I've got 3 divs inside of a container div, with the last div inside the container having an overflow:auto; property (as it has scrollable content). The whole container div is floated left.

How can I get the last interior div to expand with the screen resolution? The problem here seems to be that my container div has no real "size" so when I set it to height: 100%; nothing really happens. Of course this means that if I assign it an actual size, then it won't grow to the resolution..

What should I do?

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

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

发布评论

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

评论(1

夜吻♂芭芘 2025-01-03 13:38:21

你查过 CSS3 媒体查询吗?这是教程演示

Have you looked up CSS3 media queries? Here's a tutorial and demo.

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