如何在 4 列 YUI grid.css 布局中细分列?

发布于 2024-10-05 08:41:10 字数 1171 浏览 8 评论 0原文

我有一个 YUI 网格,它给了我 4 个不均匀的列:

  <div class="yui-gc">
    <div class="yui-gd first">
      <div class="yui-u first">Reason</div>
      <div class="yui-u">Scope</div>
    </div>
    <div class="yui-g">
      <div class="yui-u first">Related</div>
      <div class="yui-u">Product</div>
    </div>
  </div>

下面我想要 5 列,额外的一列来自打破范围列 2/3、1/3。我能得到的最接近的是 Scope 下的 1/2、1/2:

  <div class="yui-gc">
    <div class="yui-gd first">
      <div class="yui-u first">reasons</div>
      <div class="yui-g"> <!-- split Scope column -->
        <div class="yui-u first">questions</div>
        <div class="yui-u">answers</div>
      </div>
    </div>
    <div class="yui-g">
      <div class="yui-u first">stuff</div>
      <div class="yui-u">products</div>
    </div>
  </div>

似乎将标记为 的 div 更改为

应该可以解决问题,但事实并非如此。

我缺少什么?

I have a YUI grid that gives me 4 uneven columns:

  <div class="yui-gc">
    <div class="yui-gd first">
      <div class="yui-u first">Reason</div>
      <div class="yui-u">Scope</div>
    </div>
    <div class="yui-g">
      <div class="yui-u first">Related</div>
      <div class="yui-u">Product</div>
    </div>
  </div>

Below that I want to have 5 columns, with the extra one coming from breaking the Scope column 2/3, 1/3. The closest I can get is 1/2, 1/2 under Scope:

  <div class="yui-gc">
    <div class="yui-gd first">
      <div class="yui-u first">reasons</div>
      <div class="yui-g"> <!-- split Scope column -->
        <div class="yui-u first">questions</div>
        <div class="yui-u">answers</div>
      </div>
    </div>
    <div class="yui-g">
      <div class="yui-u first">stuff</div>
      <div class="yui-u">products</div>
    </div>
  </div>

It seems like changing the div marked <!-- split Scope column --> to <div class="yui-gc"> should do the trick, but it doesn't.

What am I missing?

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

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

发布评论

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

评论(1

素手挽清风 2024-10-12 08:41:10

我确信您已经尝试过,您的 div 的 .yui-g 应该是 .yui-gc。它还需要包装在 yui-u 中,或者除了 yui-gc 之外还有一个 yui-u 类。然而 yui css 文件此时会自行崩溃。 .yui-gd div.first 规则位于 src 中的 .yui-gc div.first 规则之后并破坏它。结果是列排列为 1/3, 2/3,而不是应有的 2/3, 1/3。

alt text

最简单的(尽管可能很hacky)修复方法就是放入一个内联声明来放置列宽回到应有的位置。

<div class="yui-gc">
<div class="yui-gd first">
    <div class="yui-u first">reasons</div>
    <div class="yui-u yui-gc">
        <div class="yui-u first" style="width: 66%;">questions</div>
        <div class="yui-u" style="width: 32%;">answers</div>
    </div>
</div>

<div class="yui-u yui-g">
    <div class="yui-u first">Related</div>
    <div class="yui-u">Product</div>
</div>

as i'm sure you've already tried, the .yui-g for your div should be a .yui-gc. it also needs to be either wrapped in a yui-u or have an yui-u class in addition to the yui-gc. however the yui css file trips on itself at this point. The .yui-gd div.first rule comes after the .yui-gc div.first rule in the src and clobbers it. The result is that the columns are arranged 1/3, 2/3 instead of 2/3, 1/3 like they should be.

alt text

The simplest (as hacky as it may be) way to fix would to just put in an inline declaration to put the column widths back to where they should be.

<div class="yui-gc">
<div class="yui-gd first">
    <div class="yui-u first">reasons</div>
    <div class="yui-u yui-gc">
        <div class="yui-u first" style="width: 66%;">questions</div>
        <div class="yui-u" style="width: 32%;">answers</div>
    </div>
</div>

<div class="yui-u yui-g">
    <div class="yui-u first">Related</div>
    <div class="yui-u">Product</div>
</div>

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