如何使用网格框架实现部分灵活的屏幕布局?

发布于 2024-12-18 22:43:23 字数 257 浏览 3 评论 0原文

我正在尝试使用 CSS 网格框架(BluePrint)实现以下屏幕布局,但没有成功:

在此处输入图像描述

如何可以通过网格框架实现这一点吗?有人可以分享 CSS/HTML 代码示例吗?谢谢。

PS:我想使用框架的原因是确保此布局适用于所有浏览器(任何安全框架都可以,不一定是BluePrint)。

I am trying to implement the following screen layout using a CSS grid framework (BluePrint), but unsuccessfully:

enter image description here

How can achieve this with a grid framework? Does anyone have a CSS/HTML code example to share? Thanks.

P.S.: The reason I want to use a framework is to make sure this layout works in all browsers (any safe framework is ok, it does not have to be BluePrint).

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

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

发布评论

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

评论(2

书信已泛黄 2024-12-25 22:43:23

深入研究这个问题后,我发现用网格框架是不可能解决这个问题的。问题在于几个高度和宽度是彼此导数的。此外,根据“中心”单元的内容,也可能会出现滑动条。

我找到了一个涉及一些 Javascript 的长解决方案。我首先在 HTML 中使用 div 定义屏幕的不同单元格。然后,我检索文档宽度和高度,并使用 JQuery 设置单元格的宽度和高度。我从固定值开始,然后是简单导数,然后是复杂导数。

对于滑动条问题,我使用了此处解释的技巧。我根据滑动条的存在来调整中心列的大小,滑动条本身取决于“中心”单元的高度,而“中心”单元本身取决于屏幕的宽度。

After digging deep into this issue, I got to understand that it is impossible to solve it with a grid framework. The problem is that a couple of heights and widths are derivative of each other. Moreover, depending on the content of the 'central' cell, slide bars may appear too.

I found a long solution involving some Javascript. I first define the different cells of my screen with divs in my HTML. Then, I retrieve the document width and height and set cells' widths and heights using JQuery. I start with fix values, then simple derivatives, then complex derivatives.

For the slide bar issue, I used the trick explained here. I adjust the size of the central column according to the presence of a slide bar, which itself is depending on the height of the 'central' cell, which itself depends on the width of the screen.

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