YUI grids.css 真的那么灵活吗?

发布于 2024-07-12 19:53:48 字数 1044 浏览 6 评论 0原文

雅虎的 YUI 项目有一些非常棒的、经过充分测试的组件,我刚刚开始将它们集成到我的(固定宽度)网站中。 我实际上非常兴奋 - 我已经离开以消费者为导向的网站创建有一段时间了,看到过去几年的发展让我很开心。

非常喜欢 YUI 组件和 reset.css - 我假设我使用 Yahoo YUI grids.css 是理所当然的。 事实上,他们自己说卖得很好:

“组合页面宽度,模板 预设和嵌套网格,几乎 无限数量的复杂页面 布局是可能的”

(来自上面的 grids.css 链接)

但是,我正在尝试做一些非常简单的 3 列布局,但似乎无法做一些基本的事情 - 也没有在文档中找到如何做它们的很好的解释。

例如:

  • 我可以更改列之间的装订线吗?
  • 将 1/2、2/3、1/4 类型布局相互嵌套非常容易,但是我可以嵌套 yui-t1 模板吗?
    • (我确实在嵌套 yui-t1 选择器方面取得了有限的成功,但最终得到了多个具有相同 id 的 div,这让我相信我做错了什么。

我的网站更多的是 '设计驱动”——也就是说,有一个需要制作成页面的 Photoshop 标记,

到目前为止,我的印象是 YUI Grid 适合更多“内容驱动”的网站,在这些网站中,您可以获取不一定是新闻之类的内容。必须符合精确的设计。这是一个公平的说法吗?还是我错过了使用 grids.css 的一些技巧?

是否更适合使用具有固定定位的替代网格?


我 com/questions/348626/is-there-something-similiar-to-yui-grid">YUI 的替代品 - 如另一篇 stackoverflow 帖子中提供的

Yahoo's YUI project has some really great, well tested components that I'm just beginining to integrate to my (fixed width) site. I'm actually very excited - I've been away from consumer oriented site creation for a while and I'm having a lot of fun seeing what has developed in the last few years.

Liking YUI component and reset.css so much - I assumed that my use of Yahoo YUI grids.css was a no brainer. In fact they say sell it pretty well themselves :

"Combining Page Widths, Template
Presets, and Nesting Grids, a nearly
infinite number of complex page
layouts are possible"

(from grids.css link above)

However I'm tryin to do some really simple 3 column layouts and cant seem to do some basic things - nor find good explanations in the documentation of how to do them.

For instance:

  • Can i change the gutter between columns?
  • Nesting the 1/2, 2/3, 1/4 type layouts within each other is very easy, but can i nest the yui-t1 templates?
    • (I did get limited sucess nesting yui-t1 selectors but ended up with multiple divs having the same id which led me to believe i was doing something wrong.

My site is a lot more 'design driven' - thats to say theres a photoshop markup which needs to be made into a page.

My impression so far is that YUI Grid is suited for more 'content driven' sites where you've got content like news that doesn't necessarily have to fit into an exact design. Is that a fair statement - or am I missing some magic trick to use grids.css?

Am I better suited using an alternative grid with fixed positioning?


Alternatives to YUI
- as provided in another stackoverflow post

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

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

发布评论

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

评论(6

悟红尘 2024-07-19 19:53:48

只是想提一下,在新的 YUI 3 网格中,有一个关于如何指定网格间距的具体示例。

http://developer.yahoo.com/yui/3/示例/cssgrids/cssgrids-units.html

Just wanted to mention that in the new YUI 3 grids, there is a specific example as to how to specify grid spacing.

http://developer.yahoo.com/yui/3/examples/cssgrids/cssgrids-units.html

笑红尘 2024-07-19 19:53:48

如果您确实研究 YUI 的替代方案,请查看 Blueprint CSS Generator (http://kematzy.com/blueprint-生成器/)。 这是自定义 CSS 网格的快速好方法(基于 Blueprint CSS)。

不幸的是,我不知道 YUI 是否有类似的工具。

If you do investigate alternatives to YUI, check out the Blueprint CSS Generator (http://kematzy.com/blueprint-generator/). It's a good quick way to customize your CSS grid (based on Blueprint CSS).

Unfortunately, I do not know if there is a similar tool for YUI or not.

攒眉千度 2024-07-19 19:53:48

YUI 3 网格功能强大。 灵活、稳定简单。 看一看。

YUI 3 grids is powerful. Flexibe, stable and simple. Take a look.

昵称有卵用 2024-07-19 19:53:48

听起来您需要对 YUI 网格的默认设置进行大量自定义,对我来说,这有点违背了使用它的目的——或者更确切地说,使它不太灵活,因此效率较低。

您看过 Nate Koechley 的演讲吗? 根据记忆,我认为他确实提到可以更改列之间的装订线,并解释了如何进行自定义。

http://developer.yahoo.com/yui/grids/

基本上你可以深入研究网格的 CSS 文件,确定列之间的装订线的设置位置,并在您自己的 CSS 文件中进行调整。

It sounds like you need to make a lot of customizations to the default settings for YUI Grids, which for me, kind of semi-defeats the point of using it -- or rather, makes it less flexible and thus less effective.

Have you watched the talk given by Nate Koechley yet? From memory I think he does mentions that it's possible to change the gutter between the columns and explains how to make customizations.

http://developer.yahoo.com/yui/grids/

Basically you can dig into the CSS files for grids and identify where the gutter between columns is set and adjust that in your own CSS file.

╰ゝ天使的微笑 2024-07-19 19:53:48

您可以通过覆盖边距属性来更改装订线。 您可以通过覆盖 .yui-gb { } 等选择器或您正在使用的任何布局来全面执行此操作。 如果您只想执行一组特定的列,您可以添加另一个类并使用它,只需确保您具有比 YUI 规则更高的特异性(或者进行相同的操作,并且您的规则在 CSS 文件中的位置较低)。

我不认为模板是可嵌套的,因为它们被设计为快速抛出来完成整个页面。

网格的创建方式是专门为了满足我们获得的页面大小而设计的,这些大小是由我们自己的 UED 指南和广告格式规定的。 没有什么可以阻止您使用框架作为基础并覆盖确切的宽度/装订线等。

免责声明:我为 Y 工作!

You can change the gutter by overriding the margin attribute. You can do this across the board by overriding a selector like .yui-gb { }, etc or whichever layouts you are using. If you just want to do one specific set of columns you can add another class and use that, just make sure you have more specificity than the YUI rules (or make the same and your rule is lower in the CSS files).

I don't think the templates are nestable as they were designed to be a quickie throw up thing to do a whole page.

The way grids was created was specifically to cater for the sizes of page we get which are regimented by our own UED guidelines and our Ad formats. There is nothing to stop you using the framework as a basic and overriding the exact widths/gutters, etc.

Disclaimer: I work for Y!

吖咩 2024-07-19 19:53:48

此答案由 Nate Koechley 在 YUI 论坛 提供 - YUI 高级工程师, YUI 团队

我建议人们不要直接触摸作为网格骨架的节点。 当然,欢迎您,但正如您所注意到的,这会影响他们的稳定性和行为

我认为最好将网格节点保留为未触及的骨架,并将内容标记放入该结构中。 是的,这是一些额外的标记,但我认为它是封装因为您的内容可以独立于网格自由且安全地移动

我希望它对想要使用 YUI grid 的人有用

更新

假设这里有一些 yui-grid 标记

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

并且您想添加一些额外的边距。 正如 Nate 所说,添加一些额外的标记

<div class="yui-g">
    <div class="yui-u first">
        <div class="specialCss">
            your content goes here
        </div>
    </div>
    <div class="yui-u">

    </div>
</div>

并定义其边距、填充等...

.specialCss {
    margin:10px;
}

这样就不会影响 YUI CSS 网格的稳定性和行为

This answer has been provided by Nate Koechley at YUI forum - YUI Senior Engineer, YUI Team

I recommend that people do not directly touch the nodes that are the grid skeleton. You are welcome to, of course, but as you noticed it can impact their stability and behavior.

And

I think it is best to leave Grids' nodes as the untouched skeleton, and put your content markup within that structure. It's s bit of extra markup, yes, but I think of it as encapsulation because your content can then move freely and safely independent of the grid.

I hope it can be useful to somebody that wants to use YUI grid

UPDATE

Suppose here goes some yui- grid markup

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

And you want to add some extra margin. As said by Nate, add some extra markup

<div class="yui-g">
    <div class="yui-u first">
        <div class="specialCss">
            your content goes here
        </div>
    </div>
    <div class="yui-u">

    </div>
</div>

And define its margin, padding etc...

.specialCss {
    margin:10px;
}

This way you do not impact YUI CSS grid stability and behavior

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